diff --git a/nextcloud/rootfs/etc/cont-init.d/99-mariadb_discovery.sh b/nextcloud/rootfs/etc/cont-init.d/99-mariadb_discovery.sh index f1e1cb43e..3d787a616 100755 --- a/nextcloud/rootfs/etc/cont-init.d/99-mariadb_discovery.sh +++ b/nextcloud/rootfs/etc/cont-init.d/99-mariadb_discovery.sh @@ -7,4 +7,16 @@ if bashio::services.available 'mysql'; then bashio::log.blue "Database password : $(bashio::services "mysql" "password")" bashio::log.blue "Database name : nextcloud" bashio::log.blue "Host-name : $(bashio::services "mysql" "host"):$(bashio::services "mysql" "port")" + + # Clean if needed + for var in dbtype dbname dbuser dbhost; do + sed -i "/$var/d" /defaults/config.php + done + + # Prefill MariaDb infos + sed -i "2a \ \ 'dbtype' => 'mysql'," /defaults/config.php + sed -i "2a \ \ 'dbname' => 'nextcloud'," /defaults/config.php + sed -i "2a \ \ 'dbuser' => '$(bashio::services "mysql" "username")'," /defaults/config.php + sed -i "2a \ \ 'dbhost' => '$(bashio::services "mysql" "host"):$(bashio::services "mysql" "port")'," /defaults/config.php + sed -i "2a \ \ 'dbpassword' => '$(bashio::services "mysql" "password")'," /defaults/config.php fi