summaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorfx <[email protected]>2023-10-18 15:11:44 +0200
committerfx <[email protected]>2023-10-18 15:11:44 +0200
commitb4f59c226c6916a3e45f1a52dc6a9b15c800297a (patch)
tree07016e2ac7278da6b63aa839065c5ad572215e50 /src/config.rs
downloadwebol-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.rs19
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 @@
1use config::Config;
2use once_cell::sync::Lazy;
3
4pub static SETTINGS: Lazy<Config> = Lazy::new(setup);
5
6fn 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}