Skip to content

Commit 982caad

Browse files
authored
Enable loading Secret Store configuration through environment variables (#1540)
### Change summary This PR complements fastly/Viceroy#527 enabling the CLI's manifest schema to recognize the env field in Secret Stores. * [x] Have you followed the guidelines in our Contributing document? * [x] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/fastly/cli/pulls) for the same update/change? ### New Feature Submissions: * [x] Does your submission pass tests? ### Changes to Core Features: * [x] Have you written new tests for your core changes, as applicable? The test fixture `fastly-viceroy-update.toml` has been updated to make sure that manifest updates persist the field. * [x] Have you successfully run tests with your changes locally? ### Are there any considerations that need to be addressed for release? This relates to fastly/Viceroy#527 but doesn't have to wait for it before releasing this.
1 parent fe8c80c commit 982caad

4 files changed

Lines changed: 9 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Breaking:
66

77
### Enhancements:
8+
- fix(manifest): Enable loading Secret Store configuration through environment variables ([#1540](https://github.com/fastly/cli/pull/1540))
89

910
### Bug fixes:
1011

pkg/manifest/file.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ func (f *File) MarshalTOML() ([]byte, error) {
127127
if e.Data != "" {
128128
obj["data"] = e.Data
129129
}
130+
if e.Env != "" {
131+
obj["env"] = e.Env
132+
}
130133
items = append(items, obj)
131134
}
132135
secretStores[key] = items

pkg/manifest/local_server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ type SecretStoreArrayEntry struct {
119119
Key string `toml:"key"`
120120
File string `toml:"file,omitempty"`
121121
Data string `toml:"data,omitempty"`
122+
Env string `toml:"env,omitempty"`
122123
}
123124

124125
// SecretStoreExternalFile represents the external key/value store,

pkg/manifest/testdata/fastly-viceroy-update.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,7 @@ data = "This is also some secret data"
7171
[[local_server.secret_stores.store_two]]
7272
key = "second"
7373
file = "/path/to/other/secret.json"
74+
75+
[[local_server.secret_stores.store_two]]
76+
key = "fourth"
77+
env = "ENV_FOURTH"

0 commit comments

Comments
 (0)