Skip to main content

systemprompt_models/profile/
server.rs

1//! Server configuration.
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct ServerConfig {
7    pub host: String,
8
9    pub port: u16,
10
11    pub api_server_url: String,
12
13    pub api_internal_url: String,
14
15    pub api_external_url: String,
16
17    #[serde(default)]
18    pub use_https: bool,
19
20    #[serde(default)]
21    pub cors_allowed_origins: Vec<String>,
22
23    #[serde(default)]
24    pub content_negotiation: ContentNegotiationConfig,
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct ContentNegotiationConfig {
29    #[serde(default)]
30    pub enabled: bool,
31
32    #[serde(default = "default_markdown_suffix")]
33    pub markdown_suffix: String,
34}
35
36impl Default for ContentNegotiationConfig {
37    fn default() -> Self {
38        Self {
39            enabled: false,
40            markdown_suffix: default_markdown_suffix(),
41        }
42    }
43}
44
45fn default_markdown_suffix() -> String {
46    ".md".to_string()
47}