Skip to content
Snippets Groups Projects
Commit cd58c321 authored by Gleb Kashkin's avatar Gleb Kashkin Committed by Alexander Turenko
Browse files

box: allow to set box.cfg table value via env var

All box.cfg options values used to be plain values or arrays. Now some
options contain key-value or nested tables.

This patch allows all such options to be set through environment
variables too.

Closes #8494
Closes #8051

@TarantoolBot document
Title: Set box.cfg table value via env vars

This patch implements a way to set tables as box.cfg options value in
two different ways:
* as plain key-value table:
```
bash> export TT_LOG_MODULES=aaa=info,bbb=error && ./tarantool
Tarantool 2.10.0-beta1-1977-g2970bd57a
type 'help' for interactive help
tarantool> box.cfg{}
...
2023-04-11 07:22:10.951 [219020] main/103/interactive/box.load_cfg I> set \
'log_modules' configuration option to {"aaa":"info","bbb":"error"}
---
...

tarantool> box.cfg.log_modules.aaa
---
- info
...

tarantool> box.cfg.log_modules.bbb
---
- error
...
```

* as a table in json encoding (important: don't forget to put env var
  value into single quotes):
NO_WRAP
```
bash> export TT_METRICS='{"labels":{"alias":"mystorage"},"include":"all","exclude":["vinyl"]}' && ./tarantool
Tarantool 2.10.0-beta1-1977-g2970bd57a
type 'help' for interactive help
tarantool> box.cfg{}
...
2023-04-11 07:26:03.635 [219288] main/103/interactive/box.load_cfg I> set \
'metrics' configuration option to {"exclude":["vinyl"],"include":"all",\
"labels":{"alias":"mystorage"}}
---
...

tarantool> box.cfg.metrics.include
---
- all
...
```
NO_WRAP
parent 1d6043fa
No related branches found
No related tags found
Loading
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