Create a superuser if environment variables are defined. (#93)
Create a superuser if environment variables are defined.
This commit is contained in:
@@ -115,6 +115,10 @@ These are the settings that you MUST change before deploying:
|
||||
- `HYPERKITTY_API_KEY`: Hyperkitty's API Key, should be set to the same value as
|
||||
set for the mailman-core.
|
||||
|
||||
- `MAILMAN_ADMIN_USER`: The username for the admin user to be created by default.
|
||||
|
||||
- `MAILMAN_ADMIN_EMAIL`: The email for the admin user to be created by default.
|
||||
|
||||
For more details on how to configure this image, please look at [Mailman-web's
|
||||
Readme](web/README.md)
|
||||
|
||||
|
||||
@@ -17,6 +17,10 @@ These are the settings that you MUST change before deploying:
|
||||
- `HYPERKITTY_API_KEY`: Hyperkitty's API Key, should be set to the same value as
|
||||
set for the mailman-core.
|
||||
|
||||
- `MAILMAN_ADMIN_USER`: The username for the admin user to be created by default.
|
||||
|
||||
- `MAILMAN_ADMIN_EMAIL`: The email for the admin user to be created by default.
|
||||
|
||||
These are the settings that are set to sane default and you do not need to
|
||||
change them unless you know what you want.
|
||||
|
||||
|
||||
@@ -89,6 +89,17 @@ python manage.py collectstatic --noinput
|
||||
# this command will upgrade the database.
|
||||
python manage.py migrate
|
||||
|
||||
|
||||
|
||||
# If MAILMAN_ADMIN_USER and MAILMAN_ADMIN_EMAIL is defined create a new
|
||||
# superuser for Django. There is no password setup so it can't login yet unless
|
||||
# the password is reset.
|
||||
if [[ -v MAILMAN_ADMIN_USER ]] && [[ -v MAILMAN_ADMIN_EMAIL ]];
|
||||
then
|
||||
echo "Creating admin user..."
|
||||
python manage.py createsuperuser --noinput --username "$MAILMAN_ADMIN_USER" --email "$MAILMAN_ADMIN_EMAIL"
|
||||
fi
|
||||
|
||||
# Create a mailman user with the specific UID and GID and do not create home
|
||||
# directory for it. Also chown the logs directory to write the files.
|
||||
chown mailman:mailman /opt/mailman-web-data -R
|
||||
|
||||
Reference in New Issue
Block a user