sfr_server/
config.rs

1//! A configuration for a server.
2
3use std::net::SocketAddr;
4use typed_builder::TypedBuilder;
5
6/// The configuration for a server.
7#[derive(Clone, Debug, TypedBuilder)]
8pub struct Config {
9    /// The listen address.
10    #[builder(default = "127.0.0.1:3000".parse().unwrap())]
11    pub sock: SocketAddr,
12
13    /// The log level when set at server startup.
14    #[builder(default = None)]
15    pub log: Option<String>,
16
17    /// The path to provide home page. The home page should presents the installation button.
18    #[builder(default = "/".into())]
19    pub home_path: String,
20
21    /// The path to receive a slash command request.
22    #[builder(default = "/slash-command".into())]
23    pub slash_command_path: String,
24
25    /// The path to receive a OAuth request.
26    #[builder(default = "/oauth/v2/redirect".into())]
27    pub oauth_path: String,
28
29    /// The configuration to serve static files.
30    #[builder(default = StaticPathConfig::builder().build())]
31    pub static_path: StaticPathConfig,
32}
33
34/// The configuration to serve static files.
35#[derive(Clone, Debug, TypedBuilder)]
36pub struct StaticPathConfig {
37    /// The HTTP path to serve static files.
38    #[builder(default = "/remote".to_string())]
39    pub http: String,
40
41    /// The local directory path to serve static files.
42    #[builder(default = "./assets/remote".to_string())]
43    pub local: String,
44}