Add session system
This commit is contained in:
@ -20,6 +20,10 @@ pub struct AppConfig {
|
||||
#[clap(long, env, default_value = "")]
|
||||
secret: String,
|
||||
|
||||
/// Specify whether the cookie should be transmitted only over secure connections
|
||||
#[clap(long, env)]
|
||||
pub cookie_secure: bool,
|
||||
|
||||
/// Auth username
|
||||
#[arg(long, env, default_value = "admin")]
|
||||
pub auth_username: String,
|
||||
@ -38,13 +42,12 @@ pub struct AppConfig {
|
||||
|
||||
/// URL where the OpenID configuration can be found
|
||||
#[arg(
|
||||
long,
|
||||
env,
|
||||
default_value = "http://localhost:9001/.well-known/openid-configuration"
|
||||
long,
|
||||
env,
|
||||
default_value = "http://localhost:9001/.well-known/openid-configuration"
|
||||
)]
|
||||
pub oidc_configuration_url: String,
|
||||
|
||||
|
||||
/// Disable OpenID authentication
|
||||
#[arg(long, env)]
|
||||
pub disable_oidc: bool,
|
||||
@ -83,11 +86,11 @@ impl AppConfig {
|
||||
let mut secret = self.secret.as_str();
|
||||
|
||||
if cfg!(debug_assertions) && secret.is_empty() {
|
||||
secret = "DEBUGKEYDEBUGKEYDEBUGKEYDEBUGKEYDEBUGKEY";
|
||||
secret = "DEBUGKEYDEBUGKEYDEBUGKEYDEBUGKEYDEBUGKEYDEBUGKEYDEBUGKEYDEBUGKEY";
|
||||
}
|
||||
|
||||
if secret.is_empty() {
|
||||
panic!("SECRET is undefined or too short (min 30 chars)!")
|
||||
panic!("SECRET is undefined or too short (min 64 chars)!")
|
||||
}
|
||||
|
||||
secret
|
||||
|
Reference in New Issue
Block a user