mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-06-20 08:25:16 +00:00
Add new configuration
This commit is contained in:
@ -24,6 +24,13 @@ pub struct RtcRelayConfig {
|
||||
pub max_users_per_video_calls: u64,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct IndependentPushService {
|
||||
pub control_url: String,
|
||||
pub control_token: String,
|
||||
pub public_url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Config {
|
||||
pub port: i32,
|
||||
@ -36,6 +43,7 @@ pub struct Config {
|
||||
pub android_direct_download_url: String,
|
||||
pub proxy: Option<String>,
|
||||
pub verbose_mode: bool,
|
||||
pub independent_push_service: Option<IndependentPushService>,
|
||||
pub database: DatabaseConfig,
|
||||
pub rtc_relay: Option<RtcRelayConfig>,
|
||||
}
|
||||
@ -97,6 +105,16 @@ impl Config {
|
||||
|
||||
let proxy = Config::yaml_str(parsed, "proxy");
|
||||
|
||||
let parsed_independent_push_service = &parsed["independent-push-service"];
|
||||
let independent_push_service = match parsed_independent_push_service.is_badvalue() {
|
||||
true => None,
|
||||
false => Some(IndependentPushService {
|
||||
control_url: Config::yaml_str(parsed_independent_push_service, "control-url"),
|
||||
control_token: Config::yaml_str(parsed_independent_push_service, "control-token"),
|
||||
public_url: Config::yaml_str(parsed_independent_push_service, "public-url"),
|
||||
})
|
||||
};
|
||||
|
||||
let conf = Config {
|
||||
port: Config::yaml_i32(parsed, "server-port") as i32,
|
||||
listen_address: Config::yaml_str(parsed, "server-address"),
|
||||
@ -117,6 +135,8 @@ impl Config {
|
||||
|
||||
verbose_mode: Config::yaml_bool(parsed, "verbose-mode"),
|
||||
|
||||
independent_push_service,
|
||||
|
||||
database: database_conf,
|
||||
|
||||
rtc_relay: rtc_config,
|
||||
|
Reference in New Issue
Block a user