diff --git a/config.yaml b/config.yaml index 8473ccc..1a1c428 100644 --- a/config.yaml +++ b/config.yaml @@ -20,6 +20,9 @@ force-https: true storage-url: http://devweb.local/comunic/current/user_data/ storage-path: /home/pierre/Documents/projets_web/comunic/current/user_data/ +# URL where Comunic Terms of use are available +terms-url: http://devweb.local/comunic/current/about.php?cgu + # Print more information to the console verbose-mode: true diff --git a/src/api_data/server_config.rs b/src/api_data/server_config.rs index fbc1165..a7e18d4 100644 --- a/src/api_data/server_config.rs +++ b/src/api_data/server_config.rs @@ -4,6 +4,7 @@ use serde::Serialize; use crate::constants::{conservation_policy, MIN_SUPPORTED_MOBILE_VERSION, password_policy}; +use crate::data::config::conf; #[derive(Serialize)] struct PasswordPolicy { @@ -30,6 +31,7 @@ struct DataConservationPolicy { #[derive(Serialize)] pub struct ServerConfig { min_supported_mobile_version: &'static str, + terms_url: String, password_policy: PasswordPolicy, data_conservation_policy: DataConservationPolicy, } @@ -38,6 +40,7 @@ impl ServerConfig { pub fn new() -> Self { ServerConfig { min_supported_mobile_version: MIN_SUPPORTED_MOBILE_VERSION, + terms_url: conf().terms_url.clone(), password_policy: PasswordPolicy { allow_email_in_password: password_policy::ALLOW_EMAIL_IN_PASSWORD, allow_name_in_password: password_policy::ALLOW_NAME_IN_PASSWORD, diff --git a/src/data/config.rs b/src/data/config.rs index e8648c2..2c9bf39 100644 --- a/src/data/config.rs +++ b/src/data/config.rs @@ -30,6 +30,7 @@ pub struct Config { pub listen_address: String, pub storage_url: String, pub storage_path: String, + pub terms_url: String, pub proxy: Option, pub force_https: bool, pub verbose_mode: bool, @@ -101,6 +102,8 @@ impl Config { storage_url: Config::yaml_str(parsed, "storage-url"), storage_path: Config::yaml_str(parsed, "storage-path"), + terms_url: Config::yaml_str(parsed, "terms-url"), + proxy: match proxy.as_ref() { "none" => None, s => Some(s.to_string())