Set database password on etherpad restore

This commit is contained in:
Bob Mottram 2017-06-25 20:28:59 +01:00
parent d609774def
commit 309479ee1c
2 changed files with 11 additions and 2 deletions

View File

@ -556,7 +556,6 @@ function install_dokuwiki {
systemctl restart php7.0-fpm
systemctl restart nginx
systemctl restart mariadb
function_check add_ddns_domain
add_ddns_domain $DOKUWIKI_DOMAIN_NAME

View File

@ -13,7 +13,7 @@
# License
# =======
#
# Copyright (C) 2016 Bob Mottram <bob@freedombone.net>
# Copyright (C) 2016-2017 Bob Mottram <bob@freedombone.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@ -360,6 +360,11 @@ function restore_local_etherpad {
if [ -f /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key ]; then
chown etherpad: /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key
fi
MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
settings_file=/var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
sed -i "s|\"password\":.*|\"password\": \"${MARIADB_PASSWORD}\",|g" $settings_file
MARIADB_PASSWORD=
fi
}
@ -405,6 +410,11 @@ function restore_remote_etherpad {
if [ -f /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key ]; then
chown etherpad: /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key
fi
MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
settings_file=/var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
sed -i "s|\"password\":.*|\"password\": \"${MARIADB_PASSWORD}\",|g" $settings_file
MARIADB_PASSWORD=
fi
}