mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 07:02:24 +00:00
config: default http options
This commit is contained in:
@@ -2,12 +2,30 @@ use rustical_frontend::FrontendConfig;
|
|||||||
use rustical_store::auth::StaticUserStoreConfig;
|
use rustical_store::auth::StaticUserStoreConfig;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
fn http_default_host() -> String {
|
||||||
|
"0.0.0.0".to_owned()
|
||||||
|
}
|
||||||
|
fn http_default_port() -> u16 {
|
||||||
|
4000
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct HttpConfig {
|
pub struct HttpConfig {
|
||||||
|
#[serde(default = "http_default_host")]
|
||||||
pub host: String,
|
pub host: String,
|
||||||
|
#[serde(default = "http_default_port")]
|
||||||
pub port: u16,
|
pub port: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for HttpConfig {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
host: http_default_host(),
|
||||||
|
port: http_default_port(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct SqliteDataStoreConfig {
|
pub struct SqliteDataStoreConfig {
|
||||||
pub db_url: String,
|
pub db_url: String,
|
||||||
@@ -34,6 +52,7 @@ pub struct TracingConfig {
|
|||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub data_store: DataStoreConfig,
|
pub data_store: DataStoreConfig,
|
||||||
pub auth: AuthConfig,
|
pub auth: AuthConfig,
|
||||||
|
#[serde(default)]
|
||||||
pub http: HttpConfig,
|
pub http: HttpConfig,
|
||||||
pub frontend: FrontendConfig,
|
pub frontend: FrontendConfig,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
|
|||||||
Reference in New Issue
Block a user