mirror of
https://github.com/dani-garcia/vaultwarden.wiki.git
synced 2026-11-07 05:48:36 +02:00
Don't let OpenDAL create a missing config folder (#7935)
The Fs operator creates its root folder if it doesn't exist, so loading the config created the data folder (or failed with a misleading invalid config.json error when it couldn't). Skip building the operator if the local config folder doesn't exist, so a missing data folder is reported again like before.
This commit is contained in:
1 parent
904b80115d
commit
17b159beff
1 file changed
+4
@@ -261,6 +261,10 @@ macro_rules! make_config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn from_file() -> Result<Option<Self>, Error> {
|
async fn from_file() -> Result<Option<Self>, Error> {
|
||||||
|
// The Fs operator would create the folder if it doesn't exist, which we never want
|
||||||
|
if !CONFIG_FILE_PARENT_DIR.starts_with("s3://") && !std::path::Path::new(&*CONFIG_FILE_PARENT_DIR).is_dir() {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
let operator = storage::operator_for_path(&CONFIG_FILE_PARENT_DIR)?;
|
let operator = storage::operator_for_path(&CONFIG_FILE_PARENT_DIR)?;
|
||||||
let config_bytes = match operator.read(&CONFIG_FILENAME).await {
|
let config_bytes = match operator.read(&CONFIG_FILENAME).await {
|
||||||
Ok(bytes) => bytes,
|
Ok(bytes) => bytes,
|
||||||
|
|||||||
Reference in new issue
Block a user