Configuration

```

Configuration

Status: NORMATIVE. Defines configuration sources and their precedence.

1. Sources, in priority order

1. CLI flags                        (highest)
2. Environment variables
3. User config file ~/.config/doiget/config.toml
4. Built-in defaults                (lowest)

A value set higher in the chain overrides any value set lower.

2. Built-in defaults

KeyDefault
store.rootPOSIX: $HOME/papers. Windows: %USERPROFILE%\papers.
cache.rootPOSIX: $HOME/.cache/doiget. Windows: %LOCALAPPDATA%\doiget\cache.
log.pathPOSIX: $HOME/.config/doiget/access.log. Windows: %APPDATA%\doiget\access.log.
log.retention_days90
network.user_agentdoiget/<version> (+https://github.com/sotashimozono/doiget)
network.unpaywall_emailunset; if unset, Unpaywall calls go to non-polite pool
network.connect_timeout_sec10
network.read_timeout_sec60
network.total_timeout_sec300
output.modequiet (see ARCHITECTURE.md §personas)
output.colorauto (honors NO_COLOR env)
output.progressfalse
output.emojifalse

3. config.toml schema

# ~/.config/doiget/config.toml — all fields optional

[store]
root = "/home/alice/papers"

[cache]
root = "/home/alice/.cache/doiget"

[log]
path = "/home/alice/.config/doiget/access.log"
retention_days = 90

[network]
user_agent = "doiget/0.1.0 (+https://github.com/sotashimozono/doiget; user=alice@example.org)"
unpaywall_email = "alice@example.org"
connect_timeout_sec = 10
read_timeout_sec = 60
total_timeout_sec = 300

[output]
mode = "human"          # human | json | quiet | mcp
color = "auto"          # auto | always | never
progress = false
emoji = false

doiget reads only the keys it knows about. Unknown keys cause a startup warning but do not fail.

4. Environment variables

All DOIGET_* env vars use SCREAMING_SNAKE_CASE. Boolean env vars accept 1 / 0, true / false. Path env vars take a single absolute path.

VariableMaps to
DOIGET_STORE_ROOTstore.root
DOIGET_CACHE_ROOTcache.root
DOIGET_LOG_PATHlog.path
DOIGET_LOG_RETENTION_DAYSlog.retention_days
DOIGET_USER_AGENTnetwork.user_agent
DOIGET_UNPAYWALL_EMAILnetwork.unpaywall_email
DOIGET_MODEoutput.mode
NO_COLORForces output.color = "never" (xdg standard).
HTTPS_PROXY / HTTP_PROXY / NO_PROXYreqwest honors these (system standard).

CapabilityProfile-related env vars are documented in CAPABILITY.md.

5. CLI flags

CLI flags use --kebab-case. Any path-or-string value with a config equivalent is overridable by flag:

FlagMaps to
--store-root <path>store.root
--log-path <path>log.path
--mode <human|json|quiet|mcp>output.mode
--color <auto|always|never>output.color
--progress / --no-progressoutput.progress
--quiet / -qimplies --mode=quiet
--jsonimplies --mode=json

doiget serve always runs in mcp mode regardless of flags. Other subcommands honor the mode resolution above.

6. Credentials file

# ~/.config/doiget/credentials.toml — optional, alternative to env vars
# Permissions MUST be 0600 on POSIX; doiget warns at startup otherwise.

[tdm.elsevier]
api_key = "..."
agreed = true

[tdm.aps]
api_key = "..."
agreed = true

[tdm.springer]
api_key = "..."
agreed = true

If both env var and credentials.toml provide the same key, env var wins.

7. Inspecting effective config

doiget config show          # prints the resolved config (with API keys redacted as ****)
doiget config path          # prints the path of the config file in use
doiget config doctor        # checks file permissions, reachability, sanity

Source: site/content/developer/config.md