This PR replaces the legacy hand-written configuration loader with a typed Settings model using config-rs and Serde.
Key changes:
Configuration is now parsed/deserialized through config-rs + Serde instead of
manually reading individual environment/UCI values.
Configuration sources are loaded in this order:
UCI
/etc/sqm-autorate-rust/config.toml
environment variables
Later sources override earlier ones.
Environment variables now mirror the nested settings structure using __ as
the section separator, for example: SQMA_NETWORK__DOWNLOAD_BASE_KBITS and SQMA_ADVANCED_SETTINGS__DRY_RUN.
The old flat environment variable names are not preserved.
UCI loading now reads the package generically and uses schema metadata derived
from the Settings structs to map known UCI sections/options into config-rs.
Boolean settings accept both native booleans and common UCI values such as 1/0, yes/no, on/off, and enabled/disabled.
Settings are validated before startup. Invalid values now produce errors
instead of being silently corrected; suspicious but valid values may produce
warnings.
Reflector lists are now parsed using the csv crate rather than manual string
splitting.
The old Config type has been removed and runtime components now use the
nested Settings structure directly.
UCI can be built vendored for development/cross-compilation, while
Linux/OpenWrt remains the production-supported target.
## Summary
This PR replaces the legacy hand-written configuration loader with a typed
`Settings` model using config-rs and Serde.
Key changes:
- Configuration is now parsed/deserialized through config-rs + Serde instead of
manually reading individual environment/UCI values.
- Configuration sources are loaded in this order:
1. UCI
2. `/etc/sqm-autorate-rust/config.toml`
3. environment variables
Later sources override earlier ones.
- Environment variables now mirror the nested settings structure using `__` as
the section separator, for example:
`SQMA_NETWORK__DOWNLOAD_BASE_KBITS` and
`SQMA_ADVANCED_SETTINGS__DRY_RUN`.
The old flat environment variable names are not preserved.
- UCI loading now reads the package generically and uses schema metadata derived
from the `Settings` structs to map known UCI sections/options into config-rs.
- Boolean settings accept both native booleans and common UCI values such as
`1/0`, `yes/no`, `on/off`, and `enabled/disabled`.
- Settings are validated before startup. Invalid values now produce errors
instead of being silently corrected; suspicious but valid values may produce
warnings.
- Reflector lists are now parsed using the `csv` crate rather than manual string
splitting.
- The old `Config` type has been removed and runtime components now use the
nested `Settings` structure directly.
- UCI can be built vendored for development/cross-compilation, while
Linux/OpenWrt remains the production-supported target.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
This PR replaces the legacy hand-written configuration loader with a typed
Settingsmodel using config-rs and Serde.Key changes:
Configuration is now parsed/deserialized through config-rs + Serde instead of
manually reading individual environment/UCI values.
Configuration sources are loaded in this order:
/etc/sqm-autorate-rust/config.tomlLater sources override earlier ones.
Environment variables now mirror the nested settings structure using
__asthe section separator, for example:
SQMA_NETWORK__DOWNLOAD_BASE_KBITSandSQMA_ADVANCED_SETTINGS__DRY_RUN.The old flat environment variable names are not preserved.
UCI loading now reads the package generically and uses schema metadata derived
from the
Settingsstructs to map known UCI sections/options into config-rs.Boolean settings accept both native booleans and common UCI values such as
1/0,yes/no,on/off, andenabled/disabled.Settings are validated before startup. Invalid values now produce errors
instead of being silently corrected; suspicious but valid values may produce
warnings.
Reflector lists are now parsed using the
csvcrate rather than manual stringsplitting.
The old
Configtype has been removed and runtime components now use thenested
Settingsstructure directly.UCI can be built vendored for development/cross-compilation, while
Linux/OpenWrt remains the production-supported target.
@@ -0,0 +1,347 @@// SPDX-FileCopyrightText: 2026-Present Nils Andreas Svee mailto:contact@lochnair.net (github @Lochnair)clippy /
unneeded
returnstatementShow more details
@@ -0,0 +93,4 @@impl FromStr for MeasurementType {type Err = ConfigError;fn from_str(s: &str) -> Result<Self, Self::Err> {clippy /
mismatched types
Show more details
clippy /
mismatched types
Show more details