introduce the INSTANCE_URL .env parameter
This commit is contained in:
parent
90c7f3da72
commit
d5d0c6f4d4
|
@ -7,3 +7,5 @@ REDIS_PORT=6379
|
||||||
REDIS_PREFIX=bfile-
|
REDIS_PREFIX=bfile-
|
||||||
|
|
||||||
USERCONTENT_DIR=/opt/user_uploads
|
USERCONTENT_DIR=/opt/user_uploads
|
||||||
|
|
||||||
|
INSTANCE_URL=http://localhost
|
|
@ -18,7 +18,8 @@ pub struct Env {
|
||||||
pub logging: bool,
|
pub logging: bool,
|
||||||
pub listen: SocketAddr,
|
pub listen: SocketAddr,
|
||||||
pub redis: Redis,
|
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> {
|
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())
|
return Err(format!("USERCONTENT_DIR is set to \"{}\", which exists but is not a directory!", &spath).into())
|
||||||
}
|
}
|
||||||
spath
|
spath
|
||||||
}
|
},
|
||||||
|
instanceurl: get_var("INSTANCE_URL")?
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue