STORAGE_BACKEND setting: use "local" if unspecified
the implementation now matches what is the README specifies
This commit is contained in:
parent
b03d474c27
commit
c64b53dfd7
1 changed files with 4 additions and 4 deletions
|
@ -27,19 +27,19 @@ impl Storage {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn from_env() -> anyhow::Result<Self> {
|
pub async fn from_env() -> anyhow::Result<Self> {
|
||||||
match env_var("STORAGE_BACKEND")?.as_ref() {
|
match env_var("STORAGE_BACKEND").as_deref() {
|
||||||
"local" => {
|
Ok("local") | Err(_) => {
|
||||||
let dir = match env_var("STORAGE_LOCAL_DIR") {
|
let dir = match env_var("STORAGE_LOCAL_DIR") {
|
||||||
Ok(dir) => dir,
|
Ok(dir) => dir,
|
||||||
Err(_) => ".".to_string(),
|
Err(_) => ".".to_string(),
|
||||||
};
|
};
|
||||||
Ok(Self::from_local_dir(PathBuf::from(dir)))
|
Ok(Self::from_local_dir(PathBuf::from(dir)))
|
||||||
}
|
}
|
||||||
"s3" => {
|
Ok("s3") => {
|
||||||
let bucket = env_var("STORAGE_S3_BUCKET")?;
|
let bucket = env_var("STORAGE_S3_BUCKET")?;
|
||||||
Ok(Self::from_s3(bucket).await)
|
Ok(Self::from_s3(bucket).await)
|
||||||
}
|
}
|
||||||
other => {
|
Ok(other) => {
|
||||||
anyhow::bail!("STORAGE_BACKEND: unexpected value {other} (expected: local/s3)")
|
anyhow::bail!("STORAGE_BACKEND: unexpected value {other} (expected: local/s3)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue