mirror of
https://github.com/netbox-community/netbox-docker.git
synced 2026-03-18 22:36:57 +00:00
Fix: Replace hardcoded default API token with random generation
This commit is contained in:
parent
909a9d0e85
commit
a456b565d5
|
|
@ -1,3 +1,4 @@
|
||||||
|
import secrets
|
||||||
from os import environ
|
from os import environ
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
@ -21,7 +22,7 @@ su_email = environ.get("SUPERUSER_EMAIL", "admin@example.com")
|
||||||
su_password = _read_secret("superuser_password", environ.get("SUPERUSER_PASSWORD", "admin"))
|
su_password = _read_secret("superuser_password", environ.get("SUPERUSER_PASSWORD", "admin"))
|
||||||
su_api_token = _read_secret(
|
su_api_token = _read_secret(
|
||||||
"superuser_api_token",
|
"superuser_api_token",
|
||||||
environ.get("SUPERUSER_API_TOKEN", "0123456789abcdef0123456789abcdef01234567"),
|
environ.get("SUPERUSER_API_TOKEN", secrets.token_hex(20)),
|
||||||
)
|
)
|
||||||
|
|
||||||
if not User.objects.filter(username=su_name):
|
if not User.objects.filter(username=su_name):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue