From d5d0c6f4d4f220275b4f2ffefcb960c7200ebf4a Mon Sep 17 00:00:00 2001 From: blek Date: Sun, 1 Oct 2023 21:08:12 +1000 Subject: [PATCH] introduce the INSTANCE_URL .env parameter --- filed/.env.example | 4 +++- filed/src/env.rs | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/filed/.env.example b/filed/.env.example index 0f1a01c..71d80da 100644 --- a/filed/.env.example +++ b/filed/.env.example @@ -6,4 +6,6 @@ REDIS_HOST=redis REDIS_PORT=6379 REDIS_PREFIX=bfile- -USERCONTENT_DIR=/opt/user_uploads \ No newline at end of file +USERCONTENT_DIR=/opt/user_uploads + +INSTANCE_URL=http://localhost \ No newline at end of file diff --git a/filed/src/env.rs b/filed/src/env.rs index f2cf1e5..40d5b66 100644 --- a/filed/src/env.rs +++ b/filed/src/env.rs @@ -18,7 +18,8 @@ pub struct Env { pub logging: bool, pub listen: SocketAddr, pub redis: Redis, - pub filedir: String + pub filedir: String, + pub instanceurl: String } fn get_var, O: From>(name: T) -> Result { @@ -51,7 +52,8 @@ pub fn loadenv() -> Result> { return Err(format!("USERCONTENT_DIR is set to \"{}\", which exists but is not a directory!", &spath).into()) } spath - } + }, + instanceurl: get_var("INSTANCE_URL")? } ) }