diff --git a/CHANGELOG.md b/CHANGELOG.md index 77ff559..20a0efa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ * Set `versionScheme` to `"early-semver"` * Upgrade `microlibs` to 4.0.0 * Update Scala.js to 1.7 +* Better clarify in reports where values are obfuscated. Instead of `<# hash #>`, obfuscated values are now displayed as `Obfuscated (hash)` ### 2.0.0 diff --git a/README.md b/README.md index b92f4ae..7b04a17 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ Used keys (5): +-------------------+------+-------------------------+---------+ | Key | Env | cp:/database.properties | Default | +-------------------+------+-------------------------+---------+ -| POSTGRES_PASSWORD | | <# 1C02B9F6 #> | | +| POSTGRES_PASSWORD | | Obfuscated (1C02B9F6) | | | POSTGRES_PORT | 4000 | | 8080 | | POSTGRES_SCHEMA | | | | | POSTGRES_URL | | http://localhost/blah | | diff --git a/core/shared/src/main/scala/japgolly/clearconfig/internals/Report.scala b/core/shared/src/main/scala/japgolly/clearconfig/internals/Report.scala index 9467375..4afe1ec 100644 --- a/core/shared/src/main/scala/japgolly/clearconfig/internals/Report.scala +++ b/core/shared/src/main/scala/japgolly/clearconfig/internals/Report.scala @@ -115,7 +115,7 @@ object Report { ValueDisplay((_, _, _, v) => if (v.length <= maxLen) v else v.take(maxLen - 1) + "…") def obfuscate: ValueDisplay = - ValueDisplay((c, _, _, v) => "%s<# %08X #>%s".format(c.secret, MurmurHash3 stringHash v, c.reset)) + ValueDisplay((c, _, _, v) => "%sObfuscated (%08X)%s".format(c.secret, MurmurHash3 stringHash v, c.reset)) def obfuscateSources(f: SourceName => Boolean): ValueDisplay = obfuscate.when((s, _, _) => f(s)) diff --git a/core/shared/src/test/scala/japgolly/clearconfig/external/ConfigReportTest.scala b/core/shared/src/test/scala/japgolly/clearconfig/external/ConfigReportTest.scala index 7026842..8c0861f 100644 --- a/core/shared/src/test/scala/japgolly/clearconfig/external/ConfigReportTest.scala +++ b/core/shared/src/test/scala/japgolly/clearconfig/external/ConfigReportTest.scala @@ -306,13 +306,13 @@ object ConfigReportTest extends TestSuite { ! - S ! !Used keys (3): - !+-----+----------------+ - !| Key | S | - !+-----+----------------+ - !| a | 1 | - !| b | <# 16CC649D #> | - !| c | 3 | - !+-----+----------------+ + !+-----+-----------------------+ + !| Key | S | + !+-----+-----------------------+ + !| a | 1 | + !| b | Obfuscated (16CC649D) | + !| c | 3 | + !+-----+-----------------------+ ! !Unused keys (0): !No data to report. @@ -372,19 +372,19 @@ object ConfigReportTest extends TestSuite { val r = c.withReport.run(s).get_!._2 "on" - assertMultiline(r.withColour.used(false), s""" - |+-----+----------------+ - || Key | S | - |+-----+----------------+ - || i | ${Console.YELLOW}<# 9C554F15 #>${Console.RESET} | - |+-----+----------------+ + |+-----+-----------------------+ + || Key | S | + |+-----+-----------------------+ + || i | ${Console.YELLOW}Obfuscated (9C554F15)${Console.RESET} | + |+-----+-----------------------+ """.stripMargin.trim) "off" - assertMultiline(r.withoutColour.used(false), """ - |+-----+----------------+ - || Key | S | - |+-----+----------------+ - || i | <# 9C554F15 #> | - |+-----+----------------+ + |+-----+-----------------------+ + || Key | S | + |+-----+-----------------------+ + || i | Obfuscated (9C554F15) | + |+-----+-----------------------+ """.stripMargin.trim) }