feat: added flexible configuration system using figment

This commit is contained in:
Jef Roosens 2025-03-08 22:07:57 +01:00
parent f16cdfdfff
commit f9ffc21a3f
Signed by: Jef Roosens
GPG key ID: 21FD3D77D56BAF49
11 changed files with 227 additions and 74 deletions

View file

@ -11,3 +11,24 @@ Gpodder, suitable for low-power devices.
* Devices API
* Subscriptions API
* Episode actions API
## Configuration
Otter is configurable via a TOML config file, environment variables and CLI
arguments thanks to the [Figment](https://docs.rs/figment/latest/figment/)
library. Each variable in the configuration file below can be provided via an
environment variable (prefixed using `OTTER_`) or a CLI argument.
```toml
data_dir = "./data"
domain = "127.0.0.1"
port = 8080
```
Otter can be told to read a config variable using the `--config/-c` flag (see
the `help` command for other useful CLI commands). Each variable needs to be
provided either from the config file, as an environment variable (e.g.
`OTTER_DATA_DIR`) or a CLI argument (e.g. `--data-dir`).
If a variable is provided in multiple ways, environment variables overwrite
configuration file variables, and CLI arguments overwrite both.