blob: f03a09bba59867da44bc7f88503bdb0fd0270b60 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
pub use config::ConfigError;
use serde::Deserialize;
#[derive(Deserialize, Debug)]
pub struct Config {
/// The ID for every italian person, it's used from Smartedu as username
pub cf: String,
/// The password of Smartedu
pub password: String,
/// Driver url, an example is `http://localhost:4444` for geckodriver
pub driver_url: String,
/// Username of the Telegram user authorized to use the bot
pub username: String,
}
impl Config {
pub fn from_env() -> Result<Self, ConfigError> {
let mut cfg = config::Config::new();
cfg.merge(config::Environment::new())?;
cfg.try_into()
}
}
|