Configuration

Configuration

Maybe Don’t is configured through a YAML file, environment variables, or a combination of both. This section covers how configuration works and the options available.

Configuration File

By default, the gateway looks for maybe-dont.yaml in these locations (in order):

  1. Path specified by --config-dir CLI flag
  2. Path specified by MAYBE_DONT_CONFIG_DIR environment variable
  3. $XDG_CONFIG_HOME/maybe-dont/ (typically ~/.config/maybe-dont/)
  4. $HOME/.config/maybe-dont/

The gateway uses the first of these that applies, even if it holds no config file. If no config file exists on first run, default files are generated.

If the config file exists but can’t be read or has a YAML error, the gateway refuses to start and prints the path with the parser error:

failed to read config file /path/to/maybe-dont.yaml: <parser error>

For example:

Error: failed to load config: failed to read config file /home/you/.config/maybe-dont/maybe-dont.yaml: While parsing config: yaml: line 155: did not find expected ',' or ']'

Earlier versions ignored such a file and started with defaults. A missing config file still falls back to defaults.

The same applies when the gateway can’t check whether the file exists, because the config directory or one of its parents can’t be searched (for example after chmod 000), or the path or one of its parents is a file. Startup fails even if environment variables alone would make a valid config:

Error: failed to bootstrap configuration: cannot access config file: stat /path/to/maybe-dont.yaml: permission denied

Earlier versions treated this as a missing file and ignored it. If you run with a default config directory the gateway can’t access, set MAYBE_DONT_CONFIG_DIR (or --config-dir) to a directory it can. A config directory that doesn’t exist behaves as before.

When XDG_CONFIG_HOME is set, the gateway uses $XDG_CONFIG_HOME/maybe-dont/ and doesn’t fall back to $HOME/.config/maybe-dont/. If that directory can’t be created or accessed, for example on a read-only filesystem, startup fails with the path:

Error: cannot use config directory (set --config-dir or MAYBE_DONT_CONFIG_DIR to use another): ...

Configuration Precedence

Values are resolved in this order (later overrides earlier):

PrioritySourceExample
1 (lowest)Config filemaybe-dont.yaml
2Environment variablesMAYBE_DONT_SERVER_TYPE=http
3 (highest)CLI flags--config-dir /custom/path

This means you can set defaults in your config file and override specific values with environment variables - useful for Docker deployments where secrets shouldn’t be in files.

Environment Variables

Any configuration option can be set via environment variable using the pattern:

MAYBE_DONT_{PATH}

Where {PATH} is the YAML path with dots replaced by underscores, in uppercase. For example:

YAML PathEnvironment Variable
server.typeMAYBE_DONT_SERVER_TYPE
server.listen_addrMAYBE_DONT_SERVER_LISTEN_ADDR
validation.ai.api_keyMAYBE_DONT_VALIDATION_AI_API_KEY
audit.pathMAYBE_DONT_AUDIT_PATH

Variable Substitution

You can reference environment variables in your config file using ${VAR_NAME} syntax:

validation:
  ai:
    api_key: "${OPENAI_API_KEY}"

downstream_mcp_servers:
  github:
    type: http
    url: "${GITHUB_MCP_URL}"

This is expanded at load time, allowing you to keep secrets out of config files while maintaining readable configuration.

Configuration Sections