Browse Source

new: dev: [nextcloud] rewrite all database values in config file

This is dubious as if we need to change more than the password, than
usually this means we need a full reinstall mode of nextcloud.
rallly
Valentin Lab 4 months ago
parent
commit
2c2c46424d
  1. 17
      nextcloud/hooks/sql_database-relation-joined

17
nextcloud/hooks/sql_database-relation-joined

@ -34,8 +34,23 @@ if [ -e "$CONFIGFILE" ] && grep "^ 'dbuser' => '" "$CONFIGFILE" >/dev/null; the
quoted_user="${quoted_user//\'/\\\\\'}"
quoted_password="${PASSWORD//\\/\\\\\\\\\\}"
quoted_password="${quoted_password//\'/\\\\\'}"
case "$TYPE" in
mysql)
nextcloud_type="mysql";;
postgres)
nextcloud_type="pgsql";;
*)
err "Unknown type '$TYPE' for database."
exit 1
;;
esac
sed -ri "s/^( 'dbuser' => ')(.*)(',)$/\1${quoted_user}\3/g;\
s/^( 'dbpassword' => ')(.*)(',)$/\1${quoted_password}\3/g;" "$CONFIGFILE"
s/^( 'dbpassword' => ')(.*)(',)$/\1${quoted_password}\3/g;\
s/^( 'dbtype' => ')(.*)(',)$/\1${nextcloud_type}\3/g;\
s/^( 'dbhost' => ')(.*)(',)$/\1${MASTER_TARGET_SERVICE_NAME}\3/g;\
" "$CONFIGFILE"
else
## These variable are not used by current docker image after first install

Loading…
Cancel
Save