annals.config#
Settings: where documents are published and what link to print.
Two values matter to a publisher:
target: where the documents go. A directory (~/.local/share/annals) or an ssh destination (tw:/root/.local/share/annals). This is the data root the annals server reads, locally or on another machine.base_url: the public root of the annals app, so a publish can print the link the owner opens (https://apps.example.com/annals).
Resolution order, highest first: explicit keyword arguments, environment variables
(ANNALS_TARGET, ANNALS_BASE_URL), the config file ($ANNALS_CONFIG or
$XDG_CONFIG_HOME/annals/config.toml, default ~/.config/annals/config.toml), then the
local defaults (publish into the local data dir, link to a local annals serve).
The server side has one knob of its own, ANNALS_DATA_DIR: the directory the API reads.
It defaults to ~/.local/share/annals, which is also the default publish target, so with
no configuration at all annals publish and annals serve meet in the same place.
Functions
|
|
The local data root: |
|
|
Resolve settings: arguments, then env, then the config file, then local defaults. |
|
Write the config file (two string keys; no TOML writer dependency needed). |
Classes
|
Where to publish and what link to print. |
- class annals.config.Settings(target, base_url, configured=True)[source]#
Bases:
objectWhere to publish and what link to print. See the module docstring for precedence.
- annals.config.default_config_path()[source]#
$ANNALS_CONFIG, else$XDG_CONFIG_HOME/annals/config.toml.- Return type:
- annals.config.default_data_dir()[source]#
The local data root:
$ANNALS_DATA_DIRor~/.local/share/annals.- Return type: