mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-06-12 05:07:40 +02:00
Next attempt for issue #709 fix
Now creates icon cache directory at startup. And it also creates the directory if it went missing during runtime. Also modified the icon_save/mark_negcache to be one.
This commit is contained in:
11
src/main.rs
11
src/main.rs
@ -25,6 +25,7 @@ extern crate num_derive;
|
||||
use std::{
|
||||
path::Path,
|
||||
process::{exit, Command},
|
||||
fs::create_dir_all,
|
||||
};
|
||||
|
||||
#[macro_use]
|
||||
@ -52,6 +53,8 @@ fn main() {
|
||||
check_web_vault();
|
||||
migrations::run_migrations();
|
||||
|
||||
create_icon_cache_folder();
|
||||
|
||||
launch_rocket();
|
||||
}
|
||||
|
||||
@ -129,8 +132,7 @@ fn check_db() {
|
||||
let path = Path::new(&url);
|
||||
|
||||
if let Some(parent) = path.parent() {
|
||||
use std::fs;
|
||||
if fs::create_dir_all(parent).is_err() {
|
||||
if create_dir_all(parent).is_err() {
|
||||
error!("Error creating database directory");
|
||||
exit(1);
|
||||
}
|
||||
@ -148,6 +150,11 @@ fn check_db() {
|
||||
db::get_connection().expect("Can't connect to DB");
|
||||
}
|
||||
|
||||
fn create_icon_cache_folder() {
|
||||
// Try to create the icon cache folder, and generate an error if it could not.
|
||||
create_dir_all(&CONFIG.icon_cache_folder()).expect("Error creating icon cache directory");
|
||||
}
|
||||
|
||||
fn check_rsa_keys() {
|
||||
// If the RSA keys don't exist, try to create them
|
||||
if !util::file_exists(&CONFIG.private_rsa_key()) || !util::file_exists(&CONFIG.public_rsa_key()) {
|
||||
|
Reference in New Issue
Block a user