Skip to content

Commit

Permalink
Update init for v4
Browse files Browse the repository at this point in the history
  • Loading branch information
thespad committed May 8, 2024
1 parent 69625b4 commit 8d651b4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions root/etc/s6-overlay/s6-rc.d/init-netbox-config/run
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ mv /defaults/uwsgi.ini /app/netbox/netbox/uwsgi.ini > /dev/null 2>&1
if [[ ! -e "/app/netbox/netbox/project-static/docs/index.html" ]]; then
cd /app/netbox || exit 1
echo "Building local documentation"
mkdocs build
mkdocs build -q
cd /app/netbox/netbox || exit 1
fi

Expand All @@ -66,13 +66,13 @@ s6-setuidgid abc python3 ./manage.py migrate

if [[ -n "$SUPERUSER_EMAIL" ]] && [[ -n "$SUPERUSER_PASSWORD" ]]; then
cat << EOF | s6-setuidgid abc python3 /app/netbox/netbox/manage.py shell
from django.contrib.auth.models import User;
from users.models import Token, User;

username = 'admin';
password = '$SUPERUSER_PASSWORD';
email = '$SUPERUSER_EMAIL';

if User.objects.filter(username=username).count()==0:
if not User.objects.filter(username='admin'):
User.objects.create_superuser(username, email, password);
print('Superuser created.');
else:
Expand Down

0 comments on commit 8d651b4

Please sign in to comment.