Remove panics on invalid env arguments
Some checks failed
/ check_lfs (pull_request) Successful in 2s
/ lint_fmt (pull_request) Failing after 16s
/ lint_clippy (pull_request) Failing after 17s
/ build (pull_request) Has been skipped

This commit is contained in:
Roman Moisieiev 2025-09-11 11:21:30 +01:00
parent a6ce057030
commit a56b7cbd3f

View file

@ -106,19 +106,21 @@ pub fn get_config() -> Config {
} }
} }
if let Ok(x) = env::var("COMMITTEE_ROLE") { if let Ok(x) = env::var("COMMITTEE_ROLE") {
let x = x.trim().parse().unwrap(); if let Ok(x) = x.trim().parse() {
config.committee_role = RoleId::new(x); config.committee_role = RoleId::new(x);
}
} }
if let Ok(x) = env::var("COMMITTEE_CATEGORY") { if let Ok(x) = env::var("COMMITTEE_CATEGORY") {
for part in x.split(',') { for part in x.split(',') {
let x = part.trim().parse().unwrap(); let Ok(x) = part.trim().parse() else { continue };
config.committee_category.push(ChannelId::new(x)); config.committee_category.push(ChannelId::new(x));
} }
} }
if let Ok(x) = env::var("COMPSOC_DISCORD") { if let Ok(x) = env::var("COMPSOC_DISCORD") {
let x = x.trim().parse().unwrap(); if let Ok(x) = x.trim().parse() {
config.compsoc_server = GuildId::new(x); config.compsoc_server = GuildId::new(x)
}
} }
config config