Skip to content

Commit

Permalink
Add explicit logging in entrypoint refs #149
Browse files Browse the repository at this point in the history
  • Loading branch information
nka11 committed Nov 21, 2023
1 parent 2dce3a5 commit 5a9e4dd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions resources/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,21 @@ shift

# If the configuration file does not exist wait until it does.

loop_count=0
while [ ! -f "${CONFIG}" ] || grep -q "__CERT_PATH__" /opt/stalwart-mail/etc/common/tls.toml; do
sleep 1
if [ $(($loop_count % 30)) -eq 0 ]; then
if [ ! -f "${CONFIG}" ]; then
echo "ERROR: Configuration file ${CONFIG} not found."
echo "Please execute 'docker exec -it $HOSTNAME stalwart-install' to fix and start service"
fi
if grep -q "__CERT_PATH__" /opt/stalwart-mail/etc/common/tls.toml; then
echo "ERROR: TLS not configured."
echo "Please check etc/common/tls.toml file in your configuration volume"
fi
echo "ERROR: Service will wait for configuration to be fixed before startup"
fi
loop_count=$(($loop_count+1))
done

# If the configuration file exists, start the server.
Expand Down

0 comments on commit 5a9e4dd

Please sign in to comment.