src/app/config/config.rs
37 lines · 690 bytes
1use std::error::Error;
2
3use super::{commands::CommandsConfig, MainConfig};
4
5#[derive(Clone, Debug)]
6pub struct Config {
7 pub commands: CommandsConfig,
8 pub main: MainConfig,
9}
10
11impl Default for Config {
12 fn default() -> Self {
13 Self {
14 commands: CommandsConfig::default(),
15 main: MainConfig::default(),
16 }
17 }
18}
19
20impl Config {
21 pub fn load() -> Result<Self, Box<dyn Error>> {
22 Ok(Self {
23 main: MainConfig::load()?,
24 commands: CommandsConfig::load()?,
25 })
26 }
27}
28
29pub struct EnvVar {
30 pub url: Option<String>,
31}
32
33impl Default for EnvVar {
34 fn default() -> Self {
35 Self { url: None }
36 }
37}