feat: support restore data to mysql database
This commit is contained in:
1 file changed
+13
@@ -87,6 +87,18 @@ function restore_db_postgresql() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function restore_db_mysql() {
|
||||||
|
color blue "restore vaultwarden mysql database"
|
||||||
|
|
||||||
|
mysql -h "${MYSQL_HOST}" -P "${MYSQL_PORT}" -u "${MYSQL_USERNAME}" -p"${MYSQL_PASSWORD}" "${MYSQL_DATABASE}" < "${RESTORE_FILE_DB}"
|
||||||
|
|
||||||
|
if [[ $? == 0 ]]; then
|
||||||
|
color green "restore vaultwarden mysql database successful"
|
||||||
|
else
|
||||||
|
color red "restore vaultwarden mysql database failed"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function restore_config() {
|
function restore_config() {
|
||||||
color blue "restore vaultwarden config"
|
color blue "restore vaultwarden config"
|
||||||
|
|
||||||
@@ -205,6 +217,7 @@ function restore_file() {
|
|||||||
case "${DB_TYPE}" in
|
case "${DB_TYPE}" in
|
||||||
SQLITE) restore_db_sqlite ;;
|
SQLITE) restore_db_sqlite ;;
|
||||||
POSTGRESQL) restore_db_postgresql ;;
|
POSTGRESQL) restore_db_postgresql ;;
|
||||||
|
MYSQL) restore_db_mysql ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
if [[ -n "${RESTORE_FILE_CONFIG}" ]]; then
|
if [[ -n "${RESTORE_FILE_CONFIG}" ]]; then
|
||||||
|
|||||||
Reference in new issue
Block a user