mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-07 21:00:30 -06:00
Merge pull request #8339 from owncloud/add-env-in-yaml
feat: use env variable in yaml config files
This commit is contained in:
15
changelog/unreleased/enhancement-env-in-yaml.md
Normal file
15
changelog/unreleased/enhancement-env-in-yaml.md
Normal file
@@ -0,0 +1,15 @@
|
||||
Enhancement: Use environment variables in yaml config files
|
||||
|
||||
We added the ability to use environment variables in yaml config files. This allows to use environment variables in the config files of the ocis services which will be replaced by the actual value of the environment variable at runtime.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
web:
|
||||
http:
|
||||
addr: ${SOME_HTTP_ADDR}
|
||||
```
|
||||
|
||||
This makes it possible to use the same config file for different environments without the need to change the config file itself. This is especially useful when using docker-compose to run the ocis services. It is a common pattern to create an .env file which contains the environment variables for the docker-compose file. Now you can use the same .env file to configure the ocis services.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/8339
|
||||
@@ -20,6 +20,7 @@ var (
|
||||
func BindSourcesToStructs(service string, dst interface{}) (*gofig.Config, error) {
|
||||
cnf := gofig.NewWithOptions(service)
|
||||
cnf.WithOptions(func(options *gofig.Options) {
|
||||
options.ParseEnv = true
|
||||
options.DecoderConfig.TagName = decoderConfigTagName
|
||||
})
|
||||
cnf.AddDriver(gooyaml.Driver)
|
||||
|
||||
Reference in New Issue
Block a user