Skip to content

env vars substitution

Illarion Kovalchuk edited this page Jul 9, 2020 · 1 revision

Environment variables substitution in config

When configuration is loaded from file, gobetween can substitute values from environment variables into placeholders in config file. This behavior is disabled by default for security and can be enabled with command line argument:

gobetween -e
gobetween --use-config-env-vars

Env variable keys must be included in config file as ${name_of_env_var}

Example:

[servers.sample]
protocol = "tcp"
bind = "${HOST}:${PORT}"

Run with

HOST=localhost PORT=3000 gobetween -e -c example-config.toml