feat: added support for teh new api key

This commit is contained in:
silver 2024-11-09 01:17:43 +00:00
parent 344d6d3585
commit 733827c3e6
Signed by: silver
GPG key ID: 36F93D61BAD3FD7D

View file

@ -24,6 +24,8 @@ pub struct Config {
// wolves API base for clubs/socs // wolves API base for clubs/socs
pub wolves_url: String, pub wolves_url: String,
// API key for accessing more general resources
pub wolves_api: String,
} }
impl TypeMapKey for Config { impl TypeMapKey for Config {
type Value = Arc<RwLock<Config>>; type Value = Arc<RwLock<Config>>;
@ -44,6 +46,7 @@ pub fn get_config() -> Config {
mail_user: "".to_string(), mail_user: "".to_string(),
mail_pass: "".to_string(), mail_pass: "".to_string(),
wolves_url: "".to_string(), wolves_url: "".to_string(),
wolves_api: "".to_string(),
}; };
if let Ok(x) = env::var("DATABASE_HOME") { if let Ok(x) = env::var("DATABASE_HOME") {
@ -74,6 +77,10 @@ pub fn get_config() -> Config {
config.wolves_url = x.trim().to_string(); config.wolves_url = x.trim().to_string();
} }
if let Ok(x) = env::var("WOLVES_API") {
config.wolves_api = x.trim().to_string();
}
config config
} }