Add open_signup config flag
All checks were successful
Push Workflows / rustfmt (push) Successful in 5s
Push Workflows / tailwind-build (push) Successful in 7s
Push Workflows / clippy (push) Successful in 18s
Push Workflows / docs (push) Successful in 22s
Push Workflows / test (push) Successful in 26s
Push Workflows / build (push) Successful in 49s
Push Workflows / nix-build (push) Successful in 5m11s
All checks were successful
Push Workflows / rustfmt (push) Successful in 5s
Push Workflows / tailwind-build (push) Successful in 7s
Push Workflows / clippy (push) Successful in 18s
Push Workflows / docs (push) Successful in 22s
Push Workflows / test (push) Successful in 26s
Push Workflows / build (push) Successful in 49s
Push Workflows / nix-build (push) Successful in 5m11s
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct AuthConfig {
|
||||
pub open_signup: bool,
|
||||
}
|
||||
|
||||
/// Build a connection URI from parts
|
||||
fn format_uri(
|
||||
scheme: &str,
|
||||
@@ -134,6 +139,7 @@ impl KeyValStoreConfig {
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
/// Top-level application configuration
|
||||
pub struct Config {
|
||||
pub auth: AuthConfig,
|
||||
pub database: DatabaseConfig,
|
||||
pub key_val_store: KeyValStoreConfig,
|
||||
}
|
||||
@@ -146,6 +152,7 @@ pub fn load_config() -> Result<Config, config::ConfigError> {
|
||||
|
||||
config::Config::builder()
|
||||
.set_default("server.port", 8080)?
|
||||
.set_default("auth.open_signup", false)?
|
||||
.add_source(File::with_name(&format!("/etc/{pkg_name}/config")).required(false))
|
||||
.add_source(File::with_name(&format!("/etc/{pkg_name}")).required(false))
|
||||
.add_source(File::with_name("config").required(false))
|
||||
|
||||
Reference in New Issue
Block a user