Skip to content

Load a config file by trying out default config file locations

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

nitn3lav/config-dirs-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

config-dirs

Load a config file by trying out default config file locations:

  • {NAME_UPPERCASE}_CONFIG envitonment variable
  • ~/.config/{name}/config.toml
  • /etc/{name}/config.toml
  • /usr/local/etc/{name}/config.toml
  • ~/Library/Preferences/{name}/config.toml
  • /usr/local/etc/{name}/config.toml
use serde::{Deserialize, Serialize};

#[derive(Debug, Deserialize, Serialize)]
struct Config {}

let config: Config = config_dirs::load("my-app", toml::from_str).expect("Failed to load config");

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in config-dirs by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Load a config file by trying out default config file locations

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages