feat: load project links from configuration
This commit is contained in:
parent
6fd79446de
commit
c92aa10327
2 changed files with 24 additions and 4 deletions
|
@ -2,6 +2,7 @@ debug = true
|
||||||
allow_registration = true
|
allow_registration = true
|
||||||
source_code = "https://github.com/mcaptcha/survey"
|
source_code = "https://github.com/mcaptcha/survey"
|
||||||
default_campaign = "b6b261fa-3ef9-4d7f-8852-339b8f81bb01"
|
default_campaign = "b6b261fa-3ef9-4d7f-8852-339b8f81bb01"
|
||||||
|
support_email="support@example.org"
|
||||||
|
|
||||||
[server]
|
[server]
|
||||||
# Please set a unique value, your kaizen instance's security depends on this being
|
# Please set a unique value, your kaizen instance's security depends on this being
|
||||||
|
@ -32,3 +33,10 @@ username = "postgres"
|
||||||
password = "password"
|
password = "password"
|
||||||
name = "postgres"
|
name = "postgres"
|
||||||
pool = 4
|
pool = 4
|
||||||
|
|
||||||
|
[footer]
|
||||||
|
about = "https://mcapthca.org/about"
|
||||||
|
donate = "https://mcapthca.org/donate"
|
||||||
|
thanks = "https://mcapthca.org/thanks"
|
||||||
|
privacy = "https://mcapthca.org/privacy"
|
||||||
|
security = "https://mcapthca.org/security"
|
||||||
|
|
|
@ -20,10 +20,11 @@ use std::path::Path;
|
||||||
use config::{Config, ConfigError, Environment, File};
|
use config::{Config, ConfigError, Environment, File};
|
||||||
use log::{debug, warn};
|
use log::{debug, warn};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
use serde::Serialize;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct Server {
|
pub struct Server {
|
||||||
pub port: u32,
|
pub port: u32,
|
||||||
pub domain: String,
|
pub domain: String,
|
||||||
|
@ -40,7 +41,7 @@ impl Server {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
struct DatabaseBuilder {
|
struct DatabaseBuilder {
|
||||||
pub port: u32,
|
pub port: u32,
|
||||||
pub hostname: String,
|
pub hostname: String,
|
||||||
|
@ -68,20 +69,31 @@ impl DatabaseBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct Database {
|
pub struct Database {
|
||||||
pub url: String,
|
pub url: String,
|
||||||
pub pool: u32,
|
pub pool: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct Footer {
|
||||||
|
pub about: Url,
|
||||||
|
pub privacy: Url,
|
||||||
|
pub security: Url,
|
||||||
|
pub donate: Url,
|
||||||
|
pub thanks: Url,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct Settings {
|
pub struct Settings {
|
||||||
pub debug: bool,
|
pub debug: bool,
|
||||||
pub allow_registration: bool,
|
pub allow_registration: bool,
|
||||||
pub database: Database,
|
pub database: Database,
|
||||||
pub server: Server,
|
pub server: Server,
|
||||||
pub source_code: String,
|
pub source_code: String,
|
||||||
|
pub support_email: String,
|
||||||
pub default_campaign: String,
|
pub default_campaign: String,
|
||||||
|
pub footer: Footer,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(tarpaulin_include))]
|
#[cfg(not(tarpaulin_include))]
|
||||||
|
|
Loading…
Reference in a new issue