Open aeijdenberg opened 6 years ago
@nwmac - is this set of proposed changes of interest to the Stratos team? We found that having the option to specify config this way worked well for deployment within a CloudFoundry app. I've just updated the linked branch above to rebase on current code.
@nwmac - now the big Go refactor has been merged, I've rebased our branch and submitted PR #2866 which implements as described above.
Let me know your thoughts.
Detailed Description
We'd like to add support for specifying runtime configuration properties via CloudFoundry user-provided services.
For example, an operator would specify prior to deployment:
And then in the
manifest.yml
:We've found this pattern works better than other obvious alternatives with CloudFoundry because:
manifest.yml
as an environment variable is challenging with respect to public source repositories.Context
Currently runtime properties are spread between:
./config.properties
filemanifest.yml
)/etc/secrets
directorySome settings appear to only work if specified in the
./config.properties
file, others appear to allow overriding by environment variables.Possible Implementation
Last year we made a small Go library to handle looking up environment variables from a list of sources, e.g. first look for environment variables, falling back to data provided by a user provided services, falling back to defaults.
We (cloud.gov.au team) worked with 18F to integrate this with their console.
I've made an experimental change to integrate the same library with the Stratos codebase which is linked as a PR below.
The change is actually quite small - the main part (in
main.go
) is this method, which initialises an env.VarSet:which is passed around to each component that needs to lookup anything from any of the config sources (that is, it is a replacement for the the
config.GetValue()
calls).The branch above compiles and pushes, I haven't tested any deeper than that yet, but we can look at if this is a direction worth pursuing.