Skip to content

config.context: define cluster config parts in env/file #3954

Closed
@TarantoolBot

Description

@TarantoolBot

Related dev. issue(s): tarantool/tarantool#9506
Parent doc issue: #3666

Product: Tarantool
Since: 3.0
Root document:

SME: @ Totktonada

Details

Example:

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.

Requested by @ Totktonada in tarantool/tarantool@830578c.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions