Can download uploaded images

This commit is contained in:
2023-08-07 14:53:44 +02:00
parent c6148f6562
commit 75438f4ae0
10 changed files with 166 additions and 6 deletions

View File

@ -18,6 +18,10 @@ pub struct AppConfig {
#[clap(short, long, env)]
pub proxy_ip: Option<String>,
/// Secret key, used to sign some resources. Must be randomly generated
#[clap(long, env, default_value = "")]
secret: String,
/// PostgreSQL database host
#[clap(long, env, default_value = "localhost")]
db_host: String,
@ -159,6 +163,21 @@ impl AppConfig {
&ARGS
}
/// Get app secret
pub fn secret(&self) -> &str {
let mut secret = self.secret.as_str();
if cfg!(debug_assertions) && secret.is_empty() {
secret = "DEBUGKEYDEBUGKEYDEBUGKEYDEBUGKEYDEBUGKEY";
}
if secret.is_empty() {
panic!("SECRET is undefined or too short (min 30 chars)!")
}
secret
}
/// Get full db connection chain
pub fn db_connection_chain(&self) -> String {
format!(