From a6b669a00709b94d868a7068c08f6ccfacc3ce9b Mon Sep 17 00:00:00 2001 From: blek Date: Sat, 7 Oct 2023 19:29:11 +1000 Subject: [PATCH] add uploads path env variable --- filed/.env.example | 3 ++- filed/src/env.rs | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/filed/.env.example b/filed/.env.example index 71d80da..f399e1e 100644 --- a/filed/.env.example +++ b/filed/.env.example @@ -8,4 +8,5 @@ REDIS_PREFIX=bfile- USERCONTENT_DIR=/opt/user_uploads -INSTANCE_URL=http://localhost \ No newline at end of file +INSTANCE_URL=http://localhost +UPLOADS_PATH=file # can be only one alphanumeric word diff --git a/filed/src/env.rs b/filed/src/env.rs index 40d5b66..f561384 100644 --- a/filed/src/env.rs +++ b/filed/src/env.rs @@ -19,7 +19,8 @@ pub struct Env { pub listen: SocketAddr, pub redis: Redis, pub filedir: String, - pub instanceurl: String + pub instanceurl: String, + pub uploadspath: String } fn get_var, O: From>(name: T) -> Result { @@ -53,7 +54,8 @@ pub fn loadenv() -> Result> { } spath }, - instanceurl: get_var("INSTANCE_URL")? + instanceurl: get_var("INSTANCE_URL")?, + uploadspath: get_var("UPLOADS_PATH")? } ) }