Skip to content

Config files ​

fnox merges several files into one configuration. This lets a monorepo share providers at the root, each service add its own secrets, and each developer keep personal overrides out of git.

Which files are loaded ​

From the current directory, fnox walks up toward the filesystem root and loads every config it finds, plus your global config. Later files override earlier ones:

OrderFileCommitted?
1~/.config/fnox/config.toml (global)No, personal
2fnox.toml in the outermost parent directoryYes
3fnox.<profile>.toml there, for each active profileYes
4fnox.local.toml thereNo, gitignored
…the same three files in each directory closer to you
lastfnox.local.toml in the current directoryNo, gitignored

So a closer directory always beats its parent, and within one directory fnox.local.toml beats profile files, which beat fnox.toml.

Each file can also be hidden (.fnox.toml, .fnox.local.toml) or live in a .config/ directory (.config/fnox.toml, .config/fnox.staging.toml, .config/fnox.local.toml). They work the same. If a directory has more than one form, fnox.toml loads first, then .fnox.toml, then .config/fnox.toml.

See what is loaded, in order:

sh
fnox config-files
fnox list --sources   # which file defined each secret

A monorepo example ​

text
project/
├── fnox.toml            # providers and shared secrets
└── services/
    ├── api/
    │   └── fnox.toml    # API secrets
    └── worker/
        └── fnox.toml    # worker secrets
toml
# project/fnox.toml
[providers.age]
type = "age"
recipients = ["age1..."]

[secrets]
LOG_LEVEL = { default = "info" }
JWT_SECRET = { provider = "age", value = "YWdl..." }
toml
# project/services/api/fnox.toml
[secrets]
DATABASE_URL = { provider = "age", value = "YWdl..." }
LOG_LEVEL = { default = "debug" }

From services/api/, fnox sees JWT_SECRET from the root, DATABASE_URL from the API, and LOG_LEVEL = "debug". From services/worker/, LOG_LEVEL stays info.

To stop the upward search at a directory, set root = true in its fnox.toml. The global config still loads.

Merging rules ​

  • Secrets merge by name. A closer file's definition of DATABASE_URL replaces the whole definition from a parent.
  • Providers merge by name, and each provider is replaced as a unit. A [providers.age] in fnox.local.toml replaces the committed [providers.age] unless merge = true combines the two. Give unrelated personal providers a distinct name such as sync-age.
  • Top-level settings such as default_provider and if_missing take the closest value.

Combine provider fields ​

Set merge = true on a provider entry to combine it with entries of the same name in other files, field by field. For example, a project can commit the age recipients while each developer keeps their own identity in the global config:

toml
# fnox.toml, committed
[providers.age]
type = "age"
recipients = ["age1...", "ssh-ed25519 AAAA..."]
toml
# ~/.config/fnox/config.toml
[providers.op]
type = "1password"

[providers.age]
type = "age"
merge = true
identity = { provider = "op", value = "op://Private/My Age Key/password" }

fnox then encrypts to the project's recipients and decrypts with the developer's identity.

  • The later file wins for each field it sets. Arrays and the recipients table are replaced; the identities and options tables are combined by name.
  • Either entry can set merge = true, with one exception: fields of a global config entry are shared only if the global entry sets it. A project cannot opt in to your credentials. If the global side declares a provider more than once, such as in an imported file or a global profile, every one of those entries must set merge = true for a project to combine with them.
  • merge = false replaces earlier entries, as do entries of a different type. Later entries combine with the replacement, not with what it replaced.
  • Each entry still needs type and that type's required fields. An age entry with merge = true may omit recipients.
  • The same rules apply between a top-level provider and a profile's entry of that name.
  • Relative paths still resolve against the file that declares them.

WARNING

A global entry with merge = true combines with the entry of that name in any project, and the project's fields win. Before adding it to an entry that holds a credential, such as a Vault token, consider that a project could set the address it is sent to.

Local overrides ​

fnox.local.toml is for things that should never be committed: personal values, a local database URL, or the encrypted cache that fnox sync writes. Add it to .gitignore:

sh
printf 'fnox.local.toml\n.fnox.local.toml\n' >> .gitignore
toml
# fnox.local.toml
[secrets]
DATABASE_URL = { default = "postgresql://localhost/alice_dev" }

default values are plaintext. For a sensitive personal value, use an encryption provider or a vault reference here too.

A top-level secret in fnox.local.toml overrides that secret in every profile, including ones defined under [profiles.*] or in a profile file. To override a secret for one profile only, put it under [profiles.<name>.secrets] in fnox.local.toml.

Profile files ​

fnox.staging.toml is loaded only when the staging profile is active. Top-level providers, secrets, leases, and default_provider in it are treated as part of the staging profile, so you can write it like a plain fnox.toml. It is a way to keep each environment in its own committed file instead of [profiles.*] sections. With several active profiles, their files load in the order the profiles were given. fnox.default.toml is never loaded.

Global config ​

~/.config/fnox/config.toml (or $FNOX_CONFIG_DIR/config.toml) is the base layer for every project. Use it for personal providers, such as the age key behind your sync cache, and for tokens you want everywhere:

sh
mkdir -p ~/.config/fnox
age-keygen -o ~/.config/fnox/age.txt     # prints your public key (age1...)
fnox provider add sync-age age --global  # writes a placeholder recipient
"${EDITOR:-vi}" ~/.config/fnox/config.toml # replace "age1..." with your public key
fnox set GITHUB_TOKEN --global --provider sync-age

Imports ​

import pulls other files into a config explicitly, regardless of directory. Paths are relative to the importing file, and the importing file's own settings win:

toml
import = ["../shared/providers.toml", "./envs/common.toml"]

Use directory layering for "everything under this folder", and imports for a shared bundle that several unrelated projects use.

Use one file only ​

Pass an explicit path to skip the directory search and local overrides:

sh
fnox -c ./fnox.toml check --all

fnox then loads that file, its imports, and the global config. This is useful for checking exactly what is committed.

WARNING

A bare default filename such as -c fnox.toml is not an explicit path. fnox treats it like running without -c: it searches parent directories and applies fnox.local.toml. Write -c ./fnox.toml (or an absolute path) to skip the directory search and fnox.local.toml; fnox still applies that file's imports and the global config.

Secret references in provider config ​

Many provider fields accept { secret = "NAME" } instead of a literal, so a provider's own credential can be stored as a secret:

toml
[providers.vault]
type = "vault"
address = "https://vault.example.com:8200"
token = { secret = "VAULT_TOKEN" }

[secrets]
VAULT_TOKEN = { provider = "age", value = "YWdl...", env = false }
DATABASE_URL = { provider = "vault", value = "database/password" }

fnox resolves VAULT_TOKEN first (from config, then the environment), then uses it to configure the provider. Cycles are reported as errors.

Ciphertext in separate files ​

Inline ciphertext makes fnox.toml noisy to review. With an encryption provider such as age, source keeps each secret's ciphertext in its own file instead of value:

bash
fnox set DATABASE_URL "postgres://..." --provider age --source secrets/DATABASE_URL.age
toml
[secrets]
DATABASE_URL = { provider = "age", source = "secrets/DATABASE_URL.age" }

fnox.toml stays a readable index, and rotating one secret changes one small file. fnox set and fnox reencrypt write to the source file, and fnox get reads it like an inline value.

The path is relative to the directory of the config that declares the secret. It cannot be absolute or contain .., and a link in a directory above the file cannot lead out of that directory. A link as the file itself, as a dotfiles manager makes, may point anywhere and is followed. fnox set and fnox edit refuse a path where a file already exists that does not belong to the same secret. source cannot be combined with value. fnox set --source refuses providers that do not encrypt, such as plain. Removing a secret leaves its file on disk. If a dotfiles manager links the source file into place, fnox writes through the link.

See also ​

MIT LicenseCopyright © 2026jdx.dev