introduce the INSTANCE_URL .env parameter

This commit is contained in:
blek 2023-10-01 21:08:12 +10:00
parent 90c7f3da72
commit d5d0c6f4d4
Signed by: blek
GPG Key ID: 14546221E3595D0C
2 changed files with 7 additions and 3 deletions

View File

@ -7,3 +7,5 @@ REDIS_PORT=6379
REDIS_PREFIX=bfile-
USERCONTENT_DIR=/opt/user_uploads
INSTANCE_URL=http://localhost

View File

@ -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<T: Into<String>, O: From<String>>(name: T) -> Result<O, String> {
@ -51,7 +52,8 @@ pub fn loadenv() -> Result<Env, Box<dyn std::error::Error>> {
return Err(format!("USERCONTENT_DIR is set to \"{}\", which exists but is not a directory!", &spath).into())
}
spath
}
},
instanceurl: get_var("INSTANCE_URL")?
}
)
}