aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel García <[email protected]>2021-04-29 15:58:29 +0200
committerDaniel García <[email protected]>2021-04-29 16:01:04 +0200
commit1e5306b8203a7ebe24047910e6c690c18c6d827a (patch)
treeaa6fbb8b7a4c072d7daf7ecd782b9a375cf3c0aa
parent6890c25ea16f350b67d5f6035671f39a26b36d9a (diff)
downloadvaultwarden-1e5306b8203a7ebe24047910e6c690c18c6d827a.tar.gz
vaultwarden-1e5306b8203a7ebe24047910e6c690c18c6d827a.zip
Remove warning when compiling only with mysql and add compatibility mode with the old docker script names1.21.0
-rwxr-xr-xdocker/start.sh10
-rw-r--r--src/db/mod.rs6
2 files changed, 12 insertions, 4 deletions
diff --git a/docker/start.sh b/docker/start.sh
index 993ddbd9..c3946c84 100755
--- a/docker/start.sh
+++ b/docker/start.sh
@@ -2,6 +2,9 @@
if [ -r /etc/vaultwarden.sh ]; then
. /etc/vaultwarden.sh
+elif [ -r /etc/bitwarden_rs.sh ]; then
+ echo "### You are using the old /etc/bitwarden_rs.sh script, please migrate to /etc/vaultwarden.sh ###"
+ . /etc/bitwarden_rs.sh
fi
if [ -d /etc/vaultwarden.d ]; then
@@ -10,6 +13,13 @@ if [ -d /etc/vaultwarden.d ]; then
. $f
fi
done
+elif [ -d /etc/bitwarden_rs.d ]; then
+ echo "### You are using the old /etc/bitwarden_rs.d script directory, please migrate to /etc/vaultwarden.d ###"
+ for f in /etc/bitwarden_rs.d/*.sh; do
+ if [ -r $f ]; then
+ . $f
+ fi
+ done
fi
exec /vaultwarden "${@}"
diff --git a/src/db/mod.rs b/src/db/mod.rs
index 5ab4ba36..ba922427 100644
--- a/src/db/mod.rs
+++ b/src/db/mod.rs
@@ -1,4 +1,3 @@
-use chrono::prelude::*;
use diesel::r2d2::{ConnectionManager, Pool, PooledConnection};
use rocket::{
http::Status,
@@ -228,12 +227,11 @@ pub fn backup_database(conn: &DbConn) -> Result<(), Error> {
use std::path::Path;
let db_url = CONFIG.database_url();
let db_path = Path::new(&db_url).parent().unwrap().to_string_lossy();
- let file_date = Utc::now().format("%Y%m%d_%H%M%S").to_string();
+ let file_date = chrono::Utc::now().format("%Y%m%d_%H%M%S").to_string();
diesel::sql_query(format!("VACUUM INTO '{}/db_{}.sqlite3'", db_path, file_date)).execute(conn)?;
+ Ok(())
}
}
-
- Ok(())
}
/// Get the SQL Server version