Skip to content

Commit b9baf1c

Browse files
committed
Include sensitive values in dotenv export content.
1 parent 899bc17 commit b9baf1c

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ The format is based on [Keep a Changelog], and this project adheres to
1010
[keep a changelog]: https://keepachangelog.com/en/1.0.0/
1111
[semantic versioning]: https://semver.org/spec/v2.0.0.html
1212

13+
## [1.0.3] - 2023-04-20
14+
15+
### Changed
16+
17+
- `export/dotenv` mode now includes sensitive values in the output
18+
1319
## [1.0.2] - 2023-03-29
1420

1521
### Fixed
@@ -201,6 +207,7 @@ The two most important changes in usage are:
201207
[1.0.0]: https://github.com/dogmatiq/ferrite/releases/tag/v1.0.0
202208
[1.0.1]: https://github.com/dogmatiq/ferrite/releases/tag/v1.0.1
203209
[1.0.2]: https://github.com/dogmatiq/ferrite/releases/tag/v1.0.2
210+
[1.0.3]: https://github.com/dogmatiq/ferrite/releases/tag/v1.0.3
204211

205212
<!-- version template
206213
## [0.0.1] - YYYY-MM-DD

internal/mode/export/dotenv/run.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func Run(opts mode.Config) {
2323
if def, ok := s.Default(); ok {
2424
x := def.Quote()
2525
if s.IsSensitive() {
26-
x = strings.Repeat("*", len(def.String))
26+
x = strings.Repeat("*", len(x))
2727
}
2828
must.Fprintf(opts.Out, "default: %s", x)
2929
} else if s.IsDeprecated() {
@@ -41,7 +41,7 @@ func Run(opts mode.Config) {
4141
must.Fprintf(opts.Out, ")\n")
4242
must.Fprintf(opts.Out, "export %s=", s.Name())
4343

44-
if v.Source() == variable.SourceEnvironment && !s.IsSensitive() {
44+
if v.Source() == variable.SourceEnvironment {
4545
err := v.Error()
4646
if err, ok := err.(variable.ValueError); ok {
4747
must.Fprintf(

mode_dotenv_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func ExampleInit_exportDotEnvFile() {
9898
// export FERRITE_STRING='hello, world!'
9999
//
100100
// # example sensitive string (default: ********, sensitive)
101-
// export FERRITE_STRING_SENSITIVE=
101+
// export FERRITE_STRING_SENSITIVE=hunter2
102102
//
103103
// # kubernetes "ferrite-svc" service host (deprecated)
104104
// export FERRITE_SVC_SERVICE_HOST=host.example.org

0 commit comments

Comments
 (0)