From 89d10e485eda2d5dd01dd8aa93bb9e3e7d67e395 Mon Sep 17 00:00:00 2001 From: Amir Moradi Date: Mon, 31 Aug 2020 00:48:41 +0200 Subject: [PATCH] Allow creation of Nextcloud admin user By using the default next cloud variables; NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD; we may now create the admin user so that the nextcloud instance is fully ready on the first launch. --- rootfs/etc/cont-init.d/03-config.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/rootfs/etc/cont-init.d/03-config.sh b/rootfs/etc/cont-init.d/03-config.sh index aeaeb13..6b8a6a1 100644 --- a/rootfs/etc/cont-init.d/03-config.sh +++ b/rootfs/etc/cont-init.d/03-config.sh @@ -114,6 +114,20 @@ if [ ! -f /data/config/config.php ]; then # https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/automatic_configuration.html touch /tmp/first-install echo "Creating automatic configuration..." + if [ -z "$NEXTCLOUD_ADMIN_USER" ]; then + cat > /var/www/config/autoconfig.php < '/data/data', + 'dbtype' => '${DB_TYPE}', + 'dbname' => '${DB_NAME}', + 'dbuser' => '${DB_USER}', + 'dbpass' => '${DB_PASSWORD}', + 'dbhost' => '${DB_HOST}', + 'dbtableprefix' => '', +); +EOL + else cat > /var/www/config/autoconfig.php < '${DB_PASSWORD}', 'dbhost' => '${DB_HOST}', 'dbtableprefix' => '', + 'adminlogin' => '${NEXTCLOUD_ADMIN_USER}', + 'adminpass' => '${NEXTCLOUD_ADMIN_PASSWORD}', ); EOL + fi runas_user cat > /data/config/config.php <