Skip to content

Config

Turna configuration is decoded into four main sections: loads, preprocess, server, and services.

yaml
log_level: info
print: "turna started for {{ .APP_NAME }}"

loads: []
preprocess: []
server: {}
services: []

Startup Order

Turna applies configuration and runtime work in this order:

  1. Load bootstrap settings from environment variables.
  2. Load Turna application config from Consul, Vault, file, and environment sources depending on config_set.
  3. Run loads and store loaded data in template memory.
  4. Run preprocess modules.
  5. Render and write the top-level print message to logs when configured.
  6. Start server entrypoints and routers.
  7. Start services.

Dynamic loads can update loaded data later. When that happens, Turna refreshes template data and service filters.

Top-Level Fields

FieldTypeDescription
log_levelstringApplication log level. Default is info.
printstringTemplate rendered after loads and preprocess complete.
loadsarrayExternal data loaders. See Loads.
preprocessarrayPre-start file processors. See Preprocess.
serverobjectHTTP/TCP server configuration. See Server.
servicesarrayLocal commands to run. See Services.

Bootstrap Settings

Bootstrap settings decide where the Turna config itself is loaded from.

yaml
prefix:
  vault: ""
  consul: ""
app_name: turna
config_set:
  consul: false
  vault: false
  file: true

Equivalent environment variables:

sh
APP_NAME=turna
PREFIX_CONSUL=finops
PREFIX_VAULT=secret
CONFIG_SET_CONSUL=false
CONFIG_SET_VAULT=false
CONFIG_SET_FILE=true

The effective loader order is Consul, Vault, file, and environment. Environment variables are always loaded last.

File Config

File loading is enabled by default. Supported extensions are toml, yaml, yml, and json.

Turna looks for a file named after APP_NAME, which defaults to turna, such as turna.yaml. Set CONFIG_FILE to use a specific file name.

sh
CONFIG_FILE=local.yaml turna

Consul And Vault Client Environment

Consul uses github.com/hashicorp/consul/api environment variables. Common options:

Environment variableDescription
CONSUL_HTTP_ADDRConsul address.
CONSUL_HTTP_TOKEN_FILEFile containing the Consul token.
CONSUL_HTTP_TOKENConsul token.
CONSUL_HTTP_AUTHHTTP basic auth.
CONSUL_HTTP_SSLEnable TLS.
CONSUL_TLS_SERVER_NAMETLS server name.
CONSUL_CACERTCA certificate file.
CONSUL_CAPATHCA certificate directory.
CONSUL_CLIENT_CERTClient certificate.
CONSUL_CLIENT_KEYClient key.
CONSUL_HTTP_SSL_VERIFYTLS verification toggle.
CONSUL_NAMESPACEConsul namespace.
CONSUL_PARTITIONConsul partition.

Vault uses github.com/hashicorp/vault/api environment variables. Common options:

Environment variableDescription
VAULT_ADDRVault address.
VAULT_TOKENVault token.
VAULT_ROLE_IDAppRole role ID.
VAULT_ROLE_SECRETAppRole secret.
VAULT_AGENT_ADDRVault agent address.
VAULT_MAX_RETRIESRetry count.
VAULT_CACERTCA certificate file.
VAULT_CACERT_BYTESCA certificate bytes.
VAULT_CAPATHCA certificate directory.
VAULT_CLIENT_CERTClient certificate.
VAULT_CLIENT_KEYClient key.
VAULT_RATE_LIMITClient-side rate limit.
VAULT_CLIENT_TIMEOUTClient timeout.
VAULT_SKIP_VERIFYSkip TLS verification.
VAULT_TLS_SERVER_NAMETLS server name.
VAULT_HTTP_PROXYHTTP proxy.
VAULT_PROXY_ADDRProxy address.
VAULT_DISABLE_REDIRECTSDisable redirects.
VAULT_APPROLE_BASE_PATHAppRole login path.