feat: add support for passing teh compsoc server id via env
This commit is contained in:
parent
f841039c53
commit
72226cc59b
1 changed files with 10 additions and 0 deletions
10
src/lib.rs
10
src/lib.rs
|
@ -33,6 +33,9 @@ pub struct Config {
|
||||||
pub committee_server: GuildId,
|
pub committee_server: GuildId,
|
||||||
pub committee_role: RoleId,
|
pub committee_role: RoleId,
|
||||||
pub committee_category: ChannelId,
|
pub committee_category: ChannelId,
|
||||||
|
|
||||||
|
// items pertaining to compsoc only
|
||||||
|
pub compsoc_server: GuildId,
|
||||||
}
|
}
|
||||||
impl TypeMapKey for Config {
|
impl TypeMapKey for Config {
|
||||||
type Value = Arc<RwLock<Config>>;
|
type Value = Arc<RwLock<Config>>;
|
||||||
|
@ -58,6 +61,7 @@ pub fn get_config() -> Config {
|
||||||
committee_server: GuildId::new(1),
|
committee_server: GuildId::new(1),
|
||||||
committee_role: RoleId::new(1),
|
committee_role: RoleId::new(1),
|
||||||
committee_category: ChannelId::new(1),
|
committee_category: ChannelId::new(1),
|
||||||
|
compsoc_server: GuildId::new(1),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Ok(x) = env::var("DATABASE_HOME") {
|
if let Ok(x) = env::var("DATABASE_HOME") {
|
||||||
|
@ -110,6 +114,12 @@ pub fn get_config() -> Config {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Ok(x) = env::var("COMPSOC_DISCORD") {
|
||||||
|
if let Ok(x) = x.trim().parse::<u64>() {
|
||||||
|
config.compsoc_server = GuildId::new(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
config
|
config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue