Skip to content

Set box.cfg values using environment variables #5602

@Totktonada

Description

@Totktonada

It is not always possible or handy to pass parameters inside tarantool instance. For such configurations it may be handy to define instance parameters via environment variables

Definition rules are the following:

  • Generic chain for pure tarantool is: default - ENV - box.cfg
  • Generic chain for tarantool under tarantoolctl is: default - .tarantoolctl - ENV - box.cfg

Explanation and clarification:

  • parameter, explicitly passed inside box.cfg (not by tarantoolctl's wrapper) take precedence over environment and over default
  • if no parameter passed into box.cfg, then take a look into appropriate ENV variable.
  • for tarantool running under tarantoolctl environment takes precedence over defaults from .tarantoolctl, but not over ones, passed explicitly into box.cfg

As a common prefix for tarantool's environment we take TT_
As a suffix we take uppercased version of configuration parameter name

Example:

TT_LISTEN=3301 tarantool -e 'box.cfg()'

shoud act as

tarantool -e 'box.cfg{ listen=3301 }'

Environment variables should be interpreted only during box.cfg phase
Presence of environment variables MUST NOT trigger execution of box.cfg

Rules for type conversions:

  • If some argument accepts table, then consider environment variable as comma-separated value
  • If env variable could not be parsed into correct value (for example TT_READAHEAD=abc), then appropriate error with explanation must be thrown.

Please, as an implementation details, support multiple variants of environment variable name for one config option. We will consider more convenient and handy names for some options as an aliases.

Metadata

Metadata

Assignees

Labels

featureA new functionality

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions