Format shell scripts with shfmt
This commit is contained in:
parent
c6df6a040a
commit
04ac3d5f4b
7 changed files with 73 additions and 59 deletions
|
@ -18,7 +18,7 @@ CUR_DB_WAIT_TIME=0
|
|||
while ! ./manage.py migrate 2>&1 && [ "${CUR_DB_WAIT_TIME}" -lt "${MAX_DB_WAIT_TIME}" ]; do
|
||||
echo "⏳ Waiting on DB... (${CUR_DB_WAIT_TIME}s / ${MAX_DB_WAIT_TIME}s)"
|
||||
sleep "${DB_WAIT_TIMEOUT}"
|
||||
CUR_DB_WAIT_TIME=$(( CUR_DB_WAIT_TIME + DB_WAIT_TIMEOUT ))
|
||||
CUR_DB_WAIT_TIME=$((CUR_DB_WAIT_TIME + DB_WAIT_TIMEOUT))
|
||||
done
|
||||
if [ "${CUR_DB_WAIT_TIME}" -ge "${MAX_DB_WAIT_TIME}" ]; then
|
||||
echo "❌ Waited ${MAX_DB_WAIT_TIME}s or more for the DB to become ready."
|
||||
|
@ -36,17 +36,17 @@ else
|
|||
SUPERUSER_EMAIL='admin@example.com'
|
||||
fi
|
||||
if [ -f "/run/secrets/superuser_password" ]; then
|
||||
SUPERUSER_PASSWORD="$(< /run/secrets/superuser_password)"
|
||||
SUPERUSER_PASSWORD="$(</run/secrets/superuser_password)"
|
||||
elif [ -z ${SUPERUSER_PASSWORD+x} ]; then
|
||||
SUPERUSER_PASSWORD='admin'
|
||||
fi
|
||||
if [ -f "/run/secrets/superuser_api_token" ]; then
|
||||
SUPERUSER_API_TOKEN="$(< /run/secrets/superuser_api_token)"
|
||||
SUPERUSER_API_TOKEN="$(</run/secrets/superuser_api_token)"
|
||||
elif [ -z ${SUPERUSER_API_TOKEN+x} ]; then
|
||||
SUPERUSER_API_TOKEN='0123456789abcdef0123456789abcdef01234567'
|
||||
fi
|
||||
|
||||
./manage.py shell --interface python << END
|
||||
./manage.py shell --interface python <<END
|
||||
from django.contrib.auth.models import User
|
||||
from users.models import Token
|
||||
if not User.objects.filter(username='${SUPERUSER_NAME}'):
|
||||
|
|
|
@ -22,17 +22,18 @@ load_configuration() {
|
|||
# this curl call will get a reply once unit is fully launched
|
||||
curl --silent --output /dev/null --request GET --unix-socket $UNIT_SOCKET http://localhost/
|
||||
|
||||
echo "⚙️ Applying configuration from $UNIT_CONFIG";
|
||||
echo "⚙️ Applying configuration from $UNIT_CONFIG"
|
||||
|
||||
RESP_CODE=$(curl \
|
||||
--silent \
|
||||
--output /dev/null \
|
||||
--write-out '%{http_code}' \
|
||||
--request PUT \
|
||||
--data-binary "@${UNIT_CONFIG}" \
|
||||
--unix-socket $UNIT_SOCKET \
|
||||
http://localhost/config
|
||||
)
|
||||
RESP_CODE=$(
|
||||
curl \
|
||||
--silent \
|
||||
--output /dev/null \
|
||||
--write-out '%{http_code}' \
|
||||
--request PUT \
|
||||
--data-binary "@${UNIT_CONFIG}" \
|
||||
--unix-socket $UNIT_SOCKET \
|
||||
http://localhost/config
|
||||
)
|
||||
if [ "$RESP_CODE" != "200" ]; then
|
||||
echo "⚠️ Could no load Unit configuration"
|
||||
kill "$(cat /opt/unit/unit.pid)"
|
||||
|
@ -45,9 +46,9 @@ load_configuration() {
|
|||
load_configuration &
|
||||
|
||||
exec unitd \
|
||||
--no-daemon \
|
||||
--control unix:$UNIT_SOCKET \
|
||||
--pid /opt/unit/unit.pid \
|
||||
--log /dev/stdout \
|
||||
--state /opt/unit/state/ \
|
||||
--tmp /opt/unit/tmp/
|
||||
--no-daemon \
|
||||
--control unix:$UNIT_SOCKET \
|
||||
--pid /opt/unit/unit.pid \
|
||||
--log /dev/stdout \
|
||||
--state /opt/unit/state/ \
|
||||
--tmp /opt/unit/tmp/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue