mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Merge pull request #2306 from srmeier/develop
Make use of environmental variables for superuser creation
This commit is contained in:
commit
0adc63bac1
1 changed files with 12 additions and 1 deletions
|
|
@ -1423,7 +1423,18 @@ def create_superuser():
|
|||
"\nCreate a superuser below. The superuser is Account #1, the 'owner' "
|
||||
"account of the server. Email is optional and can be empty.\n"
|
||||
)
|
||||
django.core.management.call_command("createsuperuser", interactive=True)
|
||||
from os import environ
|
||||
|
||||
username = environ.get("EVENNIA_SUPERUSER_USERNAME")
|
||||
email = environ.get("EVENNIA_SUPERUSER_EMAIL")
|
||||
password = environ.get("EVENNIA_SUPERUSER_PASSWORD")
|
||||
|
||||
if (username is not None) and (password is not None) and len(password) > 0:
|
||||
from evennia.accounts.models import AccountDB
|
||||
superuser = AccountDB.objects.create_superuser(username, email, password)
|
||||
superuser.save()
|
||||
else:
|
||||
django.core.management.call_command("createsuperuser", interactive=True)
|
||||
|
||||
|
||||
def check_database(always_return=False):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue