mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-11-09 21:49:48 -05:00
check if sqlite folder exists
instead of creating the parent folders to a sqlite database vaultwarden should just exit if it does not. this should fix issues like #2835 when a wrongly configured `DATABASE_URL` falls back to using sqlite
This commit is contained in:
committed by
Daniel García
parent
464a489b44
commit
8837660ba7
@@ -638,7 +638,15 @@ make_config! {
|
||||
|
||||
fn validate_config(cfg: &ConfigItems) -> Result<(), Error> {
|
||||
// Validate connection URL is valid and DB feature is enabled
|
||||
DbConnType::from_url(&cfg.database_url)?;
|
||||
let url = &cfg.database_url;
|
||||
if DbConnType::from_url(url)? == DbConnType::sqlite {
|
||||
let path = std::path::Path::new(&url);
|
||||
if let Some(parent) = path.parent() {
|
||||
if !parent.exists() {
|
||||
err!(format!("SQLite database directory `{}` does not exist", parent.display()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let limit = 256;
|
||||
if cfg.database_max_conns < 1 || cfg.database_max_conns > limit {
|
||||
|
||||
Reference in New Issue
Block a user