Server configuration

Configuring the Flux server — config sources, precedence, environment variables, and the complete options table.

Flux loads configuration once at process startup via pydantic-settings. There is no runtime reload — change a setting on a running server by editing the source, then restarting. This page maps every server-level field to its TOML key, environment variable, type, and default.

Where configuration comes from

Flux reads from four places, listed highest precedence first:

  1. Environment variables prefixed FLUX_, with double underscore for nested sections (FLUX_SERVER_PORT, FLUX_WORKERS__BOOTSTRAP_TOKEN, FLUX_SECURITY__ENCRYPTION__ENCRYPTION_KEY).
  2. flux.toml in the current working directory, under a top-level [flux] table.
  3. [tool.flux] in pyproject.toml in the current working directory.
  4. Built-in defaults from the Pydantic models.

flux start server accepts --host/-h and --port/-p as final overrides. There are no other CLI flags for server-level config.

The flux.toml shape

[flux]
log_level = "INFO"
server_host = "0.0.0.0"
server_port = 8000
home = ".flux"
database_url = "postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:5432/${DB_NAME}"
database_type = "postgresql"
database_pool_size = 10

[flux.workers]
# Omit to let the server auto-generate one at <home>/bootstrap-token
# bootstrap_token = "..."
module_cache_ttl = 300

[flux.security.encryption]
# encryption_key = "<openssl rand -hex 32>"

[flux.observability]
enabled = false
prometheus_enabled = true

flux.toml is the canonical location; the same keys also work under [tool.flux] in pyproject.toml. Environment variables in database_url are expanded — both ${VAR} and $VAR forms.

Server options

All fields below live at the top level of the [flux] table. Types are the Pydantic field types; defaults are the values that apply when neither TOML nor env vars supply anything.

FieldTypeDefaultEnvironment variable
debugboolfalseFLUX_DEBUG
log_levelstr"INFO"FLUX_LOG_LEVEL
log_formatstr"%(asctime)s - %(name)s - %(levelname)s - %(message)s"FLUX_LOG_FORMAT
log_date_formatstr"%Y-%m-%d %H:%M:%S"FLUX_LOG_DATE_FORMAT
server_hoststr"localhost"FLUX_SERVER_HOST
server_portint8000FLUX_SERVER_PORT
homestr".flux"FLUX_HOME
cache_pathstr".cache"FLUX_CACHE_PATH
local_storage_pathstr".data"FLUX_LOCAL_STORAGE_PATH
serializer"json" | "pkl""pkl"FLUX_SERIALIZER
database_urlstr"sqlite:///.flux/flux.db"FLUX_DATABASE_URL
database_type"sqlite" | "postgresql""sqlite" (inferred from database_url)FLUX_DATABASE_TYPE
database_pool_sizeint5FLUX_DATABASE_POOL_SIZE
database_max_overflowint10FLUX_DATABASE_MAX_OVERFLOW
database_pool_timeoutint (seconds)30FLUX_DATABASE_POOL_TIMEOUT
database_pool_recycleint (seconds)3600FLUX_DATABASE_POOL_RECYCLE
database_health_check_intervalint (seconds)300FLUX_DATABASE_HEALTH_CHECK_INTERVAL

serializer must be json or pkl (any other value raises ValueError at load). database_type auto-infers to postgresql when database_url starts with postgresql://. For backend choice and tuning see Storage backends.

Scheduling section

The server runs the scheduler in-process. These keys live under [flux.scheduling].

FieldTypeDefaultEnvironment variable
poll_intervalfloat (seconds)30.0FLUX_SCHEDULING__POLL_INTERVAL
schedule_check_tolerancefloat (seconds)1.0FLUX_SCHEDULING__SCHEDULE_CHECK_TOLERANCE
once_schedule_tolerancefloat (seconds)60.0FLUX_SCHEDULING__ONCE_SCHEDULE_TOLERANCE
auto_schedule_enabledbooltrueFLUX_SCHEDULING__AUTO_SCHEDULE_ENABLED
auto_schedule_suffixstr"_auto"FLUX_SCHEDULING__AUTO_SCHEDULE_SUFFIX

Security section

[flux.security] exposes the execution-token settings; nested tables cover encryption and auth. Full coverage is in the security pages; the server-level keys are:

FieldTypeDefaultEnvironment variable
security.auth.enabledboolfalseFLUX_SECURITY__AUTH__ENABLED
execution_token_secretstr | NoneNone (required in production)FLUX_SECURITY__EXECUTION_TOKEN_SECRET
execution_token_ttlint (seconds)604800 (7 days)FLUX_SECURITY__EXECUTION_TOKEN_TTL
security.encryption.encryption_keystr | NoneNoneFLUX_SECURITY__ENCRYPTION__ENCRYPTION_KEY

security.auth.enabled is a real, settable field — FLUX_SECURITY__AUTH__ENABLED=true enables authentication directly. The server validates the combination at startup: enabling auth with no provider configured ([flux.security.auth.oidc] or [flux.security.auth.api_keys]) is rejected with an error, and conversely enabling any provider implies enabled=true. See Authentication overview.

[flux.workers] and [flux.observability] have their own pages — see Running workers, Metrics, and Tracing.

Reload behaviour

Configuration is read once at startup and cached in a singleton (Configuration.get()). Editing flux.toml or exporting a new env var on a running server has no effect — restart the process. The Python API exposes .reload() and .override(...), but these are for tests.

What can go wrong

Wrong type in TOML. server_port = "8000" (string, not int) raises a Pydantic ValidationError at startup naming the field and expected type. Do not quote integers in TOML.

Wrong section. Top-level fields like server_host belong under [flux], not [flux.server] — there is no [flux.server] table in the model, so keys placed there are silently ignored.

Encryption key not set. Saving a secret or writing an encrypted config while security.encryption.encryption_key is None raises a clear error at encrypt time. Generate one with openssl rand -hex 32. See Encryption at rest.

CLI groups, not config keys. The start command is flux start server, not flux server start. Config keys themselves are stable in 0.56.0 — no recent renames — but CLI commands are grouped under start. See Running the server.

What’s next