You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As an application developer, I'd like a plugin that allows users to easily override app default configuration.
Example
[dependency]
config = "0.13"serde = { version = "1.0", features = ["derive"] }
dirs = "4.0"
use dip::prelude::*;fnmain(){App::new().add_plugin(ConfigPlugin).add_system(log_config).run();}#[ConfigPlugin]#[derive(Debug,Deserialize)]structConfig{base_url:String,backend:Backend,}#[derive(Debug,Deserialize)]structBackend{api_key:String,api_secret:String,}fnlog_config(config:Res<Config>){println!("{config:#?}");}
User story
As an application developer, I'd like a plugin that allows users to easily override app default configuration.
Example
Specs
User config file path priority
./{CARGO_PKG_NAME}
(e.g. project root): mainly for development purposes$HOME/.{CARGO_PKG_NAME}
$HOME/.config/{CARGO_PKG_NAME}/{CARGO_PKG_NAME}
$HOME/.config/{CARGO_PKG_NAME}
Supported file types
mehcode/config-rs#feature-flags
toml
yaml
json
json5
ini
ron
Cross-platform path
dirs-dev/dirs-rs#features
home_dir
Some($HOME)
Some({FOLDERID_Profile})
Some($HOME)
config_dir
Some($XDG_CONFIG_HOME)
orSome($HOME/.config)
Some({FOLDERID_RoamingAppData})
Some($HOME/Library/Application Support)
ConfigPlugin
derive macroOptions
CONFIG_PATH
envCONFIG_PATH=config/development cargo run
true
"config/default.toml"
config::FileFormat::Toml
""
"__"
Watch support
Async source support
Limitation
Dependencies
The text was updated successfully, but these errors were encountered: