diff --git a/peach-web/src/config.rs b/peach-web/src/config.rs index bc851f5..b4d7907 100644 --- a/peach-web/src/config.rs +++ b/peach-web/src/config.rs @@ -9,17 +9,17 @@ use crate::error::PeachWebError; use peach_lib::config_manager::get_config_value; -pub struct RouilleConfig { +pub struct ServerConfig { pub standalone_mode: bool, pub disable_auth: bool, pub addr: String, pub port: String, } -impl RouilleConfig { - pub fn new() -> Result { +impl ServerConfig { + pub fn new() -> Result { // define default config values - let config = RouilleConfig { + let config = ServerConfig { standalone_mode: get_config_value("STANDALONE_MODE")?.as_str() == "true", disable_auth: get_config_value("DISABLE_AUTH")?.as_str() == "true", addr: get_config_value("ADDR")?, diff --git a/peach-web/src/main.rs b/peach-web/src/main.rs index 72de356..b624615 100644 --- a/peach-web/src/main.rs +++ b/peach-web/src/main.rs @@ -29,12 +29,12 @@ use lazy_static::lazy_static; use log::info; // crate-local dependencies -use config::RouilleConfig; +use config::ServerConfig; use utils::theme::Theme; // load the application configuration and create the theme switcher lazy_static! { - static ref ROUILLE_CONFIG: RouilleConfig = RouilleConfig::new() + static ref SERVER_CONFIG: ServerConfig = ServerConfig::new() .expect("Failed to load rouille configuration values on server startup"); static ref THEME: RwLock = RwLock::new(Theme::Light); } @@ -52,7 +52,7 @@ fn main() { // set ip address / hostname and port for the webserver // defaults to "127.0.0.1:8000" - let addr_and_port = format!("{}:{}", ROUILLE_CONFIG.addr, ROUILLE_CONFIG.port); + let addr_and_port = format!("{}:{}", SERVER_CONFIG.addr, SERVER_CONFIG.port); // store the session data for each session and a hashmap that associates // each session id with the data @@ -68,7 +68,7 @@ fn main() { // with a name of "SID" and a duration of one hour (3600 seconds) rouille::session::session(request, "SID", 3600, |session| { // if the "DISABLE_AUTH" env var is true, authenticate the session - let mut session_data = if ROUILLE_CONFIG.disable_auth { + let mut session_data = if SERVER_CONFIG.disable_auth { Some(SessionData { _login: "success".to_string(), }) diff --git a/peach-web/src/routes/settings/menu.rs b/peach-web/src/routes/settings/menu.rs index 6745263..ad122b5 100644 --- a/peach-web/src/routes/settings/menu.rs +++ b/peach-web/src/routes/settings/menu.rs @@ -1,6 +1,6 @@ use maud::{html, PreEscaped}; -use crate::{templates, utils::theme, ROUILLE_CONFIG}; +use crate::{templates, utils::theme, SERVER_CONFIG}; // ROUTE: /settings @@ -12,7 +12,7 @@ pub fn build_template() -> PreEscaped { (PreEscaped("")) div id="settingsButtons" { // render the network settings button if we're not in standalone mode - @if !ROUILLE_CONFIG.standalone_mode { + @if !SERVER_CONFIG.standalone_mode { a id="network" class="button button-primary center" href="/settings/network" title="Network Settings" { "Network" } } a id="scuttlebutt" class="button button-primary center" href="/settings/scuttlebutt" title="Scuttlebutt Settings" { "Scuttlebutt" }