config: read cluster config parts from env/file
Fixes #9506 @TarantoolBot document Title: config.context: define cluster config parts in env/file Example: ```yaml config: context: replicator_password: from: file file: secrets/replicator_password.txt rstrip: true client_password: from: file file: secrets/client_password.txt rstrip: true credentials: users: replicator: password: '{{ context.replicator_password }}' roles: [replication] client: password: '{{ context.client_password }}' roles: [super] ``` The new `config.context` section allows a user to define its own variables, whose content resides in an environment variable or a file. The primary usage is to extract passwords from the configuration. All the variables are defined in `config.context` section as keys. Each key is a record with the following fields. * `from`: either `env` or `file` * `file`: a file path * `env`: an environment variable name * `rstrip`: whether to strip whitespace characters from the end of the data (it strips newlines too) A relative file path is interpreted as relative to `process.work_dir`. `from` is mandatory, `file` is mandatory when `from` is `file`, `env` is mandatory when `from` is `env`, `rstrip` is optional. If there is no given file or no given environment variable, an error of a configuration applying is reported.
Showing
- changelogs/unreleased/config-read-values-from-env-file.md 4 additions, 0 deletionschangelogs/unreleased/config-read-values-from-env-file.md
- doc/examples/config/replicaset.yaml 13 additions, 2 deletionsdoc/examples/config/replicaset.yaml
- doc/examples/config/replicaset_election_failover.yaml 13 additions, 2 deletionsdoc/examples/config/replicaset_election_failover.yaml
- doc/examples/config/replicaset_manual_failover.yaml 13 additions, 2 deletionsdoc/examples/config/replicaset_manual_failover.yaml
- doc/examples/config/secrets/client_password.txt 1 addition, 0 deletionsdoc/examples/config/secrets/client_password.txt
- doc/examples/config/secrets/replicator_password.txt 1 addition, 0 deletionsdoc/examples/config/secrets/replicator_password.txt
- doc/examples/config/secrets/storage_password.txt 1 addition, 0 deletionsdoc/examples/config/secrets/storage_password.txt
- doc/examples/config/sharding.yaml 13 additions, 2 deletionsdoc/examples/config/sharding.yaml
- src/box/lua/config/instance_config.lua 120 additions, 0 deletionssrc/box/lua/config/instance_config.lua
- test/config-luatest/basic_test.lua 6 additions, 0 deletionstest/config-luatest/basic_test.lua
- test/config-luatest/instance_config_schema_test.lua 1 addition, 0 deletionstest/config-luatest/instance_config_schema_test.lua
- test/config-luatest/vars_test.lua 204 additions, 0 deletionstest/config-luatest/vars_test.lua
Loading
Please register or sign in to comment