initial rewrite in rust & moderation commands
Signed-off-by: seth <getchoo@tuta.io>
This commit is contained in:
parent
b17e357b75
commit
45403e9d9b
53 changed files with 3297 additions and 2820 deletions
39
src/config/mod.rs
Normal file
39
src/config/mod.rs
Normal file
|
@ -0,0 +1,39 @@
|
|||
use color_eyre::eyre::Result;
|
||||
|
||||
mod discord;
|
||||
mod github;
|
||||
|
||||
pub use discord::*;
|
||||
pub use github::*;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Config {
|
||||
pub discord: DiscordConfig,
|
||||
pub github: GithubConfig,
|
||||
pub http_port: u16,
|
||||
pub redis_url: String,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
discord: DiscordConfig::default(),
|
||||
github: GithubConfig::default(),
|
||||
http_port: 3000,
|
||||
redis_url: "redis://localhost:6379".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn new_from_env() -> Result<Self> {
|
||||
let discord = DiscordConfig::new_from_env()?;
|
||||
let github = GithubConfig::new_from_env()?;
|
||||
|
||||
Ok(Self {
|
||||
discord,
|
||||
github,
|
||||
..Default::default()
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue