diff options
author | fx <[email protected]> | 2023-10-18 15:11:44 +0200 |
---|---|---|
committer | fx <[email protected]> | 2023-10-18 15:11:44 +0200 |
commit | b4f59c226c6916a3e45f1a52dc6a9b15c800297a (patch) | |
tree | 07016e2ac7278da6b63aa839065c5ad572215e50 /src/config.rs | |
download | webol-cli-b4f59c226c6916a3e45f1a52dc6a9b15c800297a.tar webol-cli-b4f59c226c6916a3e45f1a52dc6a9b15c800297a.tar.gz webol-cli-b4f59c226c6916a3e45f1a52dc6a9b15c800297a.zip |
basic cli, only start and get device
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..9a9e44b --- /dev/null +++ b/src/config.rs | |||
@@ -0,0 +1,19 @@ | |||
1 | use config::Config; | ||
2 | use once_cell::sync::Lazy; | ||
3 | |||
4 | pub static SETTINGS: Lazy<Config> = Lazy::new(setup); | ||
5 | |||
6 | fn setup() -> Config { | ||
7 | #[cfg(not(debug_assertions))] | ||
8 | let builder = Config::builder().add_source(config::File::with_name( | ||
9 | format!("{}/webol-cli.toml", dirs::config_dir().unwrap().to_string_lossy()).as_str(), | ||
10 | )); | ||
11 | |||
12 | #[cfg(debug_assertions)] | ||
13 | let builder = Config::builder().add_source(config::File::with_name("webol-cli.toml")); | ||
14 | |||
15 | builder | ||
16 | .add_source(config::Environment::with_prefix("WEBOL_CLI_").separator("_")) | ||
17 | .build() | ||
18 | .unwrap() | ||
19 | } | ||