config: default http options

This commit is contained in:
Lennart
2024-10-31 17:08:24 +01:00
parent 2bc3790994
commit 3a96e98f45

View File

@@ -2,12 +2,30 @@ use rustical_frontend::FrontendConfig;
use rustical_store::auth::StaticUserStoreConfig;
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)]
pub struct HttpConfig {
#[serde(default = "http_default_host")]
pub host: String,
#[serde(default = "http_default_port")]
pub port: u16,
}
impl Default for HttpConfig {
fn default() -> Self {
Self {
host: http_default_host(),
port: http_default_port(),
}
}
}
#[derive(Debug, Deserialize, Serialize)]
pub struct SqliteDataStoreConfig {
pub db_url: String,
@@ -34,6 +52,7 @@ pub struct TracingConfig {
pub struct Config {
pub data_store: DataStoreConfig,
pub auth: AuthConfig,
#[serde(default)]
pub http: HttpConfig,
pub frontend: FrontendConfig,
#[serde(default)]