mattermost/entrypoint.sh
2025-02-10 13:32:14 -05:00

25 lines
989 B
Bash

#!/bin/sh
set -e
if test -f "/run/secrets/postgres_password"; then
pwd=`cat /run/secrets/postgres_password`
if [ -z $pwd ]; then
echo >&2 "error: /run/secrets/postgres_password is empty"
exit 1
fi
echo "abra-mattermost-entrypoint.sh setting POSTGRES_PASSWORD and MM_SQLSETTINGS_DATASOURCE"
export "POSTGRES_PASSWORD"="$pwd"
export "MM_SQLSETTINGS_DATASOURCE"="postgres://mattermost:${pwd}@postgres:5432/mattermost?sslmode=disable&connect_timeout=10"
unset "pwd"
else
echo >&2 "error: /run/secrets/postgres_password does not exist"
exit 1
fi
# If the default Mattermost config hasn't already been replaced
# by the templated config this recipe generates, replace it
if ! test -f "/mattermost/config/CoopCloudManaged"; then
cp /config-to-copy.json /mattermost/config/config.json && touch /mattermost/config/CoopCloudManaged
fi
# https://github.com/mattermost/mattermost-server/blob/master/build/Dockerfile
/entrypoint.sh "mattermost"