forked from mirror/grapevine
Move TURN config to separate config section
This renames: turn_username -> turn.username turn_password -> turn.password turn_uris -> turn.uris turn_secret -> turn.secret turn_ttl -> turn.ttl
This commit is contained in:
parent
e911518aac
commit
79d5d306cc
2 changed files with 28 additions and 18 deletions
|
@ -81,15 +81,7 @@ pub(crate) struct Config {
|
|||
#[serde(default)]
|
||||
pub(crate) log_format: LogFormat,
|
||||
#[serde(default)]
|
||||
pub(crate) turn_username: String,
|
||||
#[serde(default)]
|
||||
pub(crate) turn_password: String,
|
||||
#[serde(default = "Vec::new")]
|
||||
pub(crate) turn_uris: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub(crate) turn_secret: String,
|
||||
#[serde(default = "default_turn_ttl")]
|
||||
pub(crate) turn_ttl: u64,
|
||||
pub(crate) turn: TurnConfig,
|
||||
|
||||
pub(crate) emergency_password: Option<String>,
|
||||
}
|
||||
|
@ -144,6 +136,28 @@ pub(crate) enum LogFormat {
|
|||
Json,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub(crate) struct TurnConfig {
|
||||
pub(crate) username: String,
|
||||
pub(crate) password: String,
|
||||
pub(crate) uris: Vec<String>,
|
||||
pub(crate) secret: String,
|
||||
pub(crate) ttl: u64,
|
||||
}
|
||||
|
||||
impl Default for TurnConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
username: String::new(),
|
||||
password: String::new(),
|
||||
uris: Vec::new(),
|
||||
secret: String::new(),
|
||||
ttl: 60 * 60 * 24,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn false_fn() -> bool {
|
||||
false
|
||||
}
|
||||
|
@ -213,10 +227,6 @@ fn default_log() -> EnvFilterClone {
|
|||
.expect("hardcoded env filter should be valid")
|
||||
}
|
||||
|
||||
fn default_turn_ttl() -> u64 {
|
||||
60 * 60 * 24
|
||||
}
|
||||
|
||||
// I know, it's a great name
|
||||
pub(crate) fn default_default_room_version() -> RoomVersionId {
|
||||
RoomVersionId::V10
|
||||
|
|
|
@ -366,23 +366,23 @@ impl Service {
|
|||
}
|
||||
|
||||
pub(crate) fn turn_password(&self) -> &String {
|
||||
&self.config.turn_password
|
||||
&self.config.turn.password
|
||||
}
|
||||
|
||||
pub(crate) fn turn_ttl(&self) -> u64 {
|
||||
self.config.turn_ttl
|
||||
self.config.turn.ttl
|
||||
}
|
||||
|
||||
pub(crate) fn turn_uris(&self) -> &[String] {
|
||||
&self.config.turn_uris
|
||||
&self.config.turn.uris
|
||||
}
|
||||
|
||||
pub(crate) fn turn_username(&self) -> &String {
|
||||
&self.config.turn_username
|
||||
&self.config.turn.username
|
||||
}
|
||||
|
||||
pub(crate) fn turn_secret(&self) -> &String {
|
||||
&self.config.turn_secret
|
||||
&self.config.turn.secret
|
||||
}
|
||||
|
||||
pub(crate) fn emergency_password(&self) -> &Option<String> {
|
||||
|
|
Loading…
Reference in a new issue