Skip to main content

ccs_proxy/
config.rs

1use crate::provider::ProviderKind;
2use std::path::PathBuf;
3use url::Url;
4
5#[derive(Debug, Clone)]
6pub struct ServeConfig {
7    pub provider: ProviderKind,
8    pub upstream: Url,
9    pub proxy_port: u16, // 0 = OS auto
10    pub api_port: u16,   // 0 = OS auto
11    pub data_dir: PathBuf,
12    pub redact: bool,
13    pub cors_allow: Option<String>,
14    pub api_server: bool,
15}
16
17impl ServeConfig {
18    pub fn new(provider: ProviderKind, upstream: Url, data_dir: PathBuf) -> Self {
19        Self {
20            provider,
21            upstream,
22            proxy_port: 0,
23            api_port: 0,
24            data_dir,
25            redact: true,
26            cors_allow: None,
27            api_server: true,
28        }
29    }
30}