Compare commits

...

2 Commits

3 changed files with 12 additions and 4 deletions

View File

@ -1,4 +1,9 @@
APP_LOGGING=true
APP_HOST=0.0.0.0:80
REDIS_PASS=bfile
REDIS_PASS=bfile
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_PREFIX=bfile-
USERCONTENT_DIR=/opt/user_uploads

View File

@ -8,4 +8,4 @@ To get started with this, copy either `Dockerfile.dev` or `Dockerfile.prod` to `
Then either build it manually or start it up using the `docker-compose.yml` file, which is provided in the top level directory.
## Deploying notes
Files will be saved in `/opt/useruploads`. Mount that directory into a volume or host directory to easily back up the data.
Files will be saved in `/opt/user_uploads` (as defined in `.env`). Mount that directory into a volume or host directory to easily back up the data.

View File

@ -3,7 +3,7 @@
This file provides the `loadenv` function that will do just that.
*/
use std::{env::var, net::SocketAddr, path::Path};
use std::{env::var, net::SocketAddr, path::Path, fs};
#[derive(Debug, Clone)]
pub struct Redis {
@ -45,7 +45,10 @@ pub fn loadenv() -> Result<Env, Box<dyn std::error::Error>> {
let spath: String = get_var("USERCONTENT_DIR")?;
let path = Path::new(&spath);
if ! path.exists() {
return Err(format!("USERCONTENT_DIR is set to \"{}\", which does not exist!", &spath).into())
fs::create_dir_all(path)?;
}
if ! path.is_dir() {
return Err(format!("USERCONTENT_DIR is set to \"{}\", which exists but is not a directory!", &spath).into())
}
spath
}