Skip to main content

Configuration

Configuration File

Trajectory-Trace can load configuration files from many different configuration formats:

  • json
  • toml
  • yaml

By default Trajectory-Trace searches for a file called config.[yaml, toml, json] in the current working directory. You can override the config file location by setting the CONFIG_FILE environment variable.

tracing = false
base_path = "/"
KeyDescription
tracing(optional) enable jaeger tracing
base_path(optional, experimental) the base path under which the api should be served

MQTT

[mqtt_config]
endpoint = "localhost"
port = 1883
root_topic = "/"
username = "admin" # optional
password = "password" # optional
KeyDescription
endpointThe MQTT host
portMQTT port
root_topicThe base/root topic under which Trajectory-Trace listens to mqtt messages
username(optional) the user used to connect to the MQTT broker
password(optional) the password used to connect to the MQTT broker
anonymous(optional) if enabled, no authentication is used and username and password ignored

PostgreSQL

[postgres_config]
url = "postgres://postgres:postgres@localhost:5432/postgres"
KeyDescription
urlPostgreSQL connection url

(optional) Security

[security]
admin_password = "secret123"
KeyDescription
admin_password(optional) Sets the admin password to secure certain APIs

Environment Variables

You can define all available configuration options, via environment variables. To do so build the environment key by using the TTRACE prefix and seperating keys by __.

So for example setting the PostgreSQL connection URL via environment variables can be done by setting the Environment variable TTRACE__POSTGRES_CONFIG__URL="postgres://postgres:postgres@localhost:5432/postgres"

Examples

Local Development Setup

tracing = true

[mqtt_config]
endpoint = "localhost"
port = 1883
root_topic = "development"

[postgres_config]
url = "postgres://postgres:postgres@localhost/postgres"

Required Basic Auth Header

tracing = false

[mqtt_config]
endpoint = "localhost"
port = 1883
root_topic = "development"

[postgres_config]
url = "postgres://postgres:postgres@localhost/postgres"

[security]
admin_password = "password123"