Add settings and constants
This commit is contained in:
parent
e419923939
commit
ee68405874
6 changed files with 26 additions and 8 deletions
emgauwa-controller/src
|
@ -1,6 +1,15 @@
|
|||
use config::Config;
|
||||
use emgauwa_lib::constants;
|
||||
use serde_derive::Deserialize;
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[serde(default)]
|
||||
#[allow(unused)]
|
||||
pub struct Core {
|
||||
pub host: String,
|
||||
pub port: u16,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[serde(default)]
|
||||
#[allow(unused)]
|
||||
|
@ -14,8 +23,6 @@ pub struct Logging {
|
|||
#[allow(unused)]
|
||||
pub struct Settings {
|
||||
pub database: String,
|
||||
pub port: u16,
|
||||
pub host: String,
|
||||
pub logging: Logging,
|
||||
}
|
||||
|
||||
|
@ -23,13 +30,20 @@ impl Default for Settings {
|
|||
fn default() -> Self {
|
||||
Settings {
|
||||
database: String::from("sqlite://emgauwa-controller.sqlite"),
|
||||
port: 5000,
|
||||
host: String::from("127.0.0.1"),
|
||||
logging: Logging::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Core {
|
||||
fn default() -> Self {
|
||||
Core {
|
||||
host: String::from("127.0.0.1"),
|
||||
port: constants::DEFAULT_PORT,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Logging {
|
||||
fn default() -> Self {
|
||||
Logging {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue