rust-stackedconfig
Treat multiple nested config objects (e.g. JSON or YAML files) as a single config object with precedence.
Why should I use this library?
You shouldn't, it isn't anywhere near done yet and I'm definitely not the best at keeping up with side projects. This software is pre-alpha.
Why does this library exist?
This is a fun, small side-project for me to learn rust better, but my goal is for it to be good enough eventually for someone else to use seriously.
But why I want to use it?
Have you ever had the situation where your application had complex configuration? Something like this contrived example?
notifications:
email:
address: user@example.com
on_new_post: false
on_new_message: true
appearance:
theme: dark
font:
family: Arial
size: 14pt
web:
proxy:
http: http://proxy.com
https: https://proxy.com
ssl_verify: true
trusted_hosts:
- crates.io
- rust-lang.org
credentials:
username: null
token: null
And you wanted to have multiple config files, such as on the system level in
$APPDIR/app_config.yaml, on the user level at $HOME/app_config.yaml, and
on the project level at $PROJECTDIR/app_config.yaml. Managing multiple config
files with fallback is a pain. This library aims to make it easy to work with:
extern crate serde_json;
extern crate stackedconfig;
use ;
use ;
Limitations
Currently right now it only supports serde_json. My plan is to add
serde_yaml and maybe some other formats as this project grows.
License
I put it under MIT, but honestly I really don't care what anyone does with this code. It is provided as-is. If you find a bug, feel free to submit an issue, or even better submit a PR fixing it.