feat: create admin user

This commit is contained in:
2026-03-03 02:29:04 +01:00
parent 641ac4adb6
commit 1252621778
2 changed files with 5 additions and 6 deletions

View File

@@ -22,12 +22,6 @@ USER = forgejo
[security]
INSTALL_LOCK = true
SECRET_KEY = $SECRET_KEY
INTERNAL_TOKEN = $INTERNAL_TOKEN
[service]
DISABLE_REGISTRATION = true
[session]
PROVIDER = redis
PROVIDER_CONFIG = /run/valkey/valkey.sock

View File

@@ -34,6 +34,11 @@ if ! runuser --user=postgres -- psql --quiet --tuples-only --command='\du' | gre
runuser --user=postgres -- createdb --owner=forgejo forgejo
fi
# Create admin user
if ! runuser --user forgejo -- forgejo --config %{_sysconfdir}/forgejo/conf/netoik_app.ini admin user list | grep $(make owner); then
runuser --user=forgejo -- forgejo --config %{_sysconfdir}/forgejo/conf/netoik_app.ini admin user create --username samuel --email "samuel.campos@netoik.io" --admin --random-password --random-password-length 30 --fullname "Samuel Campos"
fi
# Restart forgejo and nginx services
systemctl daemon-reload
systemctl reenable forgejo.service