add uploads path env variable
This commit is contained in:
parent
b54b4a6cd7
commit
a6b669a007
|
@ -9,3 +9,4 @@ 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
|
||||||
|
|
|
@ -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")?
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue