Configuration
Tork can be configured using a config.toml
file or by using environment variables
Configuration File
Section titled “Configuration File”Tork can be configured by creating a config.toml
file in the same directory from which it is started.
Other well-known locations that Tork will look for config files are ~/tork/config.toml
and /etc/tork/config.toml
in that order.
Alternatively, you can specify the path to the config file by using the TORK_CONFIG
env var flag. e.g.:
TORK_CONFIG=myconfig.toml ./tork run standalone
If no configuration file is found, Tork will attempt to start using sensible defaults.
The following are all the configuration options supported by Tork.
The values are the default values.
[cli]banner.mode = "console" # off | console | log
[client]endpoint = "http://localhost:8000"
[logging]level = "debug" # debug | info | warn | errorformat = "pretty" # pretty | json
[broker]type = "inmemory" # inmemory | rabbitmq
[broker.rabbitmq]url = "amqp://guest:guest@localhost:5672/"consumer.timeout = "30m"management.url = "" # default: http://{rabbit_host}:15672/durable.queues = false
[datastore]type = "postgres"
[datastore.retention]logs.duration = "168h" # 1 weekjobs.duration = "8760h" # 1 year
[datastore.postgres]dsn = "host=localhost user=tork password=tork dbname=tork port=5432 sslmode=disable"
[coordinator]address = "localhost:8000"name = "Coordinator"
[coordinator.api]endpoints.health = true # turn on|off the /health endpointendpoints.jobs = true # turn on|off the /jobs endpointsendpoints.tasks = true # turn on|off the /tasks endpointsendpoints.nodes = true # turn on|off the /nodes endpointendpoints.queues = true # turn on|off the /queues endpointendpoints.metrics = true # turn on|off the /metrics endpointendpoints.users = true # turn on|off the /users endpoints
[coordinator.queues]completed = 1 # completed queue consumerserror = 1 # error queue consumerspending = 1 # pending queue consumersstarted = 1 # started queue consumersheartbeat = 1 # heartbeat queue consumersjobs = 1 # jobs queue consumers
# cors middleware[middleware.web.cors]enabled = falseorigins = "*"methods = "*"credentials = falseheaders = "*"
# basic auth middleware[middleware.web.basicauth]enabled = false
[middleware.web.keyauth]enabled = falsekey = "" # if left blank, it will auto-generate a key and print it to the logs on startup
[middleware.web]bodylimit = "500K" # Limit can be specified as 4x, where x is one of the multiple from K, M, G, T or P.
# rate limiter middleware[middleware.web.ratelimit]enabled = falserps = 20 # requests per second per IP
# request logging[middleware.web.logger]enabled = truelevel = "DEBUG" # TRACE|DEBUG|INFO|WARN|ERRORskip = ["GET /health"] # supports wildcards (*)
[middleware.job.redact]enabled = false
[middleware.task.hostenv]vars = [] # list of host env vars to inject into tasks, supports aliases (e.g. SOME_HOST_VAR:OTHER_VAR)
[worker]address = "localhost:8001"name = "Worker"
[worker.queues]default = 1 # numbers of concurrent subscribers
# default task limits[worker.limits]cpus = "" # supports fractionsmemory = "" # e.g. 100mtimeout = "" # e.g. 3h
[mounts.bind]allowed = falsesources = [] # a list of paths that are allowed as mount sources. if empty all sources are allowed.
[mounts.temp]dir = "/tmp"
[runtime]type = "docker" # docker | shell
[runtime.shell]cmd = ["bash", "-c"] # the shell command used to execute the run scriptuid = "" # set the uid for the the task process (recommended)gid = "" # set the gid for the the task process (recommended)
[runtime.docker]config = ""privileged = false # run containers in privileged mode (not recommended)
[runtime.podman]privileged = false # run containers in privileged mode (not recommended)
Environment Variables
Section titled “Environment Variables”It is possible to override/specify any configuration property using an environment variable with the following format: TORK_
+ CONFIG_PROPERTY
, replacing dots with underscores. For example, TORK_LOGGING_LEVEL=warn
.