first commit
This commit is contained in:
24
src/config.rs
Normal file
24
src/config.rs
Normal file
@@ -0,0 +1,24 @@
|
||||
use std::env;
|
||||
|
||||
pub struct Config {
|
||||
pub ts3_server: String,
|
||||
pub ts3_query_port: u16,
|
||||
pub ts3_query_user: String,
|
||||
pub ts3_query_pass: String,
|
||||
pub rrd_file: String,
|
||||
pub rrd_update_interval: u64,
|
||||
// Dodaj inne pola z config.example.py[2]
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn load() -> Self {
|
||||
Config {
|
||||
ts3_server: env::var("TS3_SERVER").unwrap_or("linuxiarz.pl".to_string()),
|
||||
ts3_query_port: env::var("TS3_QUERY_PORT").unwrap_or("10011".to_string()).parse().unwrap(),
|
||||
ts3_query_user: env::var("TS3_QUERY_USER").unwrap_or("serveradmin".to_string()),
|
||||
ts3_query_pass: env::var("TS3_QUERY_PASS").unwrap_or("haslotestowe".to_string()),
|
||||
rrd_file: env::var("RRD_FILE").unwrap_or("rrd/linuxiarz.rrd".to_string()),
|
||||
rrd_update_interval: env::var("RRD_UPDATE_INTERVAL").unwrap_or("30".to_string()).parse().unwrap(),
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user