Skip to content
Snippets Groups Projects
Commit 830578c7 authored by Alexander Turenko's avatar Alexander Turenko Committed by Alexander Turenko
Browse files

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.
parent 43efdb79
No related branches found
No related tags found
No related merge requests found
Showing with 390 additions and 8 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment