Skip to content

Commit c44e9c6

Browse files
committed
Add admin password reset
1 parent b273df6 commit c44e9c6

File tree

1 file changed

+8
-0
lines changed
  • root/etc/s6-overlay/s6-rc.d/init-nextcloud-config

1 file changed

+8
-0
lines changed

root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ if [[ -f /config/www/nextcloud/config/needs_migration ]] || [[ -f /tmp/needs_ins
138138
--database-name="${DB_NAME}" \
139139
--database-user="${DB_USER}" \
140140
--database-pass="${DB_PASS}" \
141+
--admin-user="${ADMIN_USER:-admin}" \
141142
--admin-pass="${ADMIN_PASS}" \
142143
--data-dir=/data
143144

@@ -183,6 +184,13 @@ if occ config:system:get installed >/dev/null 2>&1; then
183184
if ! occ config:system:get upgrade.disable-web >/dev/null 2>&1; then
184185
occ config:system:set upgrade.disable-web --value=true --type=boolean
185186
fi
187+
188+
# Set admin password
189+
if [[ "${ADMIN_PASS+x}" ]]; then
190+
echo "Setting admin password"
191+
export OC_PASS=${ADMIN_PASS}
192+
occ user:resetpassword --password-from-env "${ADMIN_USER:-admin}"
193+
fi
186194
else
187195
echo "After completing the web-based installer, restart the Nextcloud container to apply default memory caching and transactional file locking configurations."
188196
echo "Alternatively, you can apply your own configurations by editing /config/www/nextcloud/config/config.php following the documentation:"

0 commit comments

Comments
 (0)