1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-22 13:29:21 +00:00

Add terms url to server config

This commit is contained in:
Pierre HUBERT 2021-02-20 09:31:38 +01:00
parent 050d241695
commit d6c2c19b37
3 changed files with 9 additions and 0 deletions

View File

@ -20,6 +20,9 @@ force-https: true
storage-url: http://devweb.local/comunic/current/user_data/ storage-url: http://devweb.local/comunic/current/user_data/
storage-path: /home/pierre/Documents/projets_web/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 # Print more information to the console
verbose-mode: true verbose-mode: true

View File

@ -4,6 +4,7 @@
use serde::Serialize; use serde::Serialize;
use crate::constants::{conservation_policy, MIN_SUPPORTED_MOBILE_VERSION, password_policy}; use crate::constants::{conservation_policy, MIN_SUPPORTED_MOBILE_VERSION, password_policy};
use crate::data::config::conf;
#[derive(Serialize)] #[derive(Serialize)]
struct PasswordPolicy { struct PasswordPolicy {
@ -30,6 +31,7 @@ struct DataConservationPolicy {
#[derive(Serialize)] #[derive(Serialize)]
pub struct ServerConfig { pub struct ServerConfig {
min_supported_mobile_version: &'static str, min_supported_mobile_version: &'static str,
terms_url: String,
password_policy: PasswordPolicy, password_policy: PasswordPolicy,
data_conservation_policy: DataConservationPolicy, data_conservation_policy: DataConservationPolicy,
} }
@ -38,6 +40,7 @@ impl ServerConfig {
pub fn new() -> Self { pub fn new() -> Self {
ServerConfig { ServerConfig {
min_supported_mobile_version: MIN_SUPPORTED_MOBILE_VERSION, min_supported_mobile_version: MIN_SUPPORTED_MOBILE_VERSION,
terms_url: conf().terms_url.clone(),
password_policy: PasswordPolicy { password_policy: PasswordPolicy {
allow_email_in_password: password_policy::ALLOW_EMAIL_IN_PASSWORD, allow_email_in_password: password_policy::ALLOW_EMAIL_IN_PASSWORD,
allow_name_in_password: password_policy::ALLOW_NAME_IN_PASSWORD, allow_name_in_password: password_policy::ALLOW_NAME_IN_PASSWORD,

View File

@ -30,6 +30,7 @@ pub struct Config {
pub listen_address: String, pub listen_address: String,
pub storage_url: String, pub storage_url: String,
pub storage_path: String, pub storage_path: String,
pub terms_url: String,
pub proxy: Option<String>, pub proxy: Option<String>,
pub force_https: bool, pub force_https: bool,
pub verbose_mode: bool, pub verbose_mode: bool,
@ -101,6 +102,8 @@ impl Config {
storage_url: Config::yaml_str(parsed, "storage-url"), storage_url: Config::yaml_str(parsed, "storage-url"),
storage_path: Config::yaml_str(parsed, "storage-path"), storage_path: Config::yaml_str(parsed, "storage-path"),
terms_url: Config::yaml_str(parsed, "terms-url"),
proxy: match proxy.as_ref() { proxy: match proxy.as_ref() {
"none" => None, "none" => None,
s => Some(s.to_string()) s => Some(s.to_string())