mirror of
				https://gitlab.com/comunic/comunicapiv3
				synced 2025-10-30 23:24:42 +00:00 
			
		
		
		
	Add terms url to server config
This commit is contained in:
		| @@ -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 | ||||
|  | ||||
|   | ||||
| @@ -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, | ||||
|   | ||||
| @@ -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<String>, | ||||
|     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()) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user