add ability to create users
This commit is contained in:
parent
f475583a6f
commit
c9dfcf3435
|
@ -19,6 +19,10 @@ services:
|
|||
- RABBITMQ_DEFAULT_USER=postal
|
||||
- RABBITMQ_DEFAULT_PASS=changeme
|
||||
- RABBITMQ_DEFAULT_VHOST=postal
|
||||
- POSTAL_FNAME=Sia
|
||||
- POSTAL_LNAME=Cat
|
||||
- POSTAL_PASSWORD=SecretCatPassword
|
||||
- POSTAL_EMAIL=myemail@catsworld.com
|
||||
mysql:
|
||||
image: mariadb:10
|
||||
container_name: postal_mysql
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
## Clean Up
|
||||
rm -rf /opt/postal/tmp/pids/*
|
||||
rm -rf /tmp/postal
|
||||
|
||||
## Generate config
|
||||
if [ ! -f /opt/postal/config/postal.yml ] || [[ $(cat /opt/postal/config/postal.yml | wc -l) < 2 ]]; then
|
||||
## Build Jinja2 Template
|
||||
|
@ -9,20 +13,31 @@ if [ ! -f /opt/postal/config/postal.yml ] || [[ $(cat /opt/postal/config/postal.
|
|||
echo " secret_key: {{secretkey}}" >> /opt/postal/config/postal.example.yml
|
||||
## Generate config and keys
|
||||
/opt/postal/bin/postal initialize-config
|
||||
## Wait for MySQL to start up
|
||||
echo "== Waiting for MySQL to start up =="
|
||||
while ! mysqladmin ping -h mysql --silent; do
|
||||
sleep 0.5
|
||||
done
|
||||
while ! mysql -hmysql -u root -p"$MYSQL_ROOT_PASSWORD" -e "use $MYSQL_DATABASE" 2> /dev/null; do
|
||||
sleep 0.5
|
||||
done
|
||||
/opt/postal/bin/postal initialize
|
||||
/opt/postal/bin/postal make-user << EOF
|
||||
"$POSTAL_EMAIL"
|
||||
"$POSTAL_FNAME"
|
||||
"$POSTAL_LNAME"
|
||||
"$POSTAL_PASSWORD"
|
||||
|
||||
else
|
||||
|
||||
## Wait for MySQL to start up
|
||||
echo "== Waiting for MySQL to start up =="
|
||||
while ! mysqladmin ping -h mysql --silent; do
|
||||
sleep 0.5
|
||||
done
|
||||
while ! mysql -hmysql -u root -p"$MYSQL_ROOT_PASSWORD" -e "use $MYSQL_DATABASE" 2> /dev/null; do
|
||||
sleep 0.5
|
||||
done
|
||||
fi
|
||||
cat /opt/postal/config/postal.yml
|
||||
|
||||
## Clean Up
|
||||
rm -rf /opt/postal/tmp/pids/*
|
||||
rm -rf /tmp/postal
|
||||
## Wait for MySQL to start up
|
||||
echo "== Waiting for MySQL to start up =="
|
||||
while ! mysqladmin ping -h mysql --silent; do
|
||||
sleep 0.5
|
||||
done
|
||||
while ! mysql -hmysql -u root -p"$MYSQL_ROOT_PASSWORD" -e "use $MYSQL_DATABASE" 2> /dev/null; do
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
## Start Postal
|
||||
/opt/postal/bin/postal "$@"
|
||||
|
|
Loading…
Reference in New Issue
Block a user