add uploads path env variable

This commit is contained in:
blek 2023-10-07 19:29:11 +10:00
parent b54b4a6cd7
commit a6b669a007
Signed by: blek
GPG Key ID: 14546221E3595D0C
2 changed files with 6 additions and 3 deletions

View File

@ -8,4 +8,5 @@ REDIS_PREFIX=bfile-
USERCONTENT_DIR=/opt/user_uploads USERCONTENT_DIR=/opt/user_uploads
INSTANCE_URL=http://localhost INSTANCE_URL=http://localhost
UPLOADS_PATH=file # can be only one alphanumeric word

View File

@ -19,7 +19,8 @@ pub struct Env {
pub listen: SocketAddr, pub listen: SocketAddr,
pub redis: Redis, pub redis: Redis,
pub filedir: String, pub filedir: String,
pub instanceurl: String pub instanceurl: String,
pub uploadspath: String
} }
fn get_var<T: Into<String>, O: From<String>>(name: T) -> Result<O, String> { fn get_var<T: Into<String>, O: From<String>>(name: T) -> Result<O, String> {
@ -53,7 +54,8 @@ pub fn loadenv() -> Result<Env, Box<dyn std::error::Error>> {
} }
spath spath
}, },
instanceurl: get_var("INSTANCE_URL")? instanceurl: get_var("INSTANCE_URL")?,
uploadspath: get_var("UPLOADS_PATH")?
} }
) )
} }