Skip to content

Commit

Permalink
api container: wait for socket
Browse files Browse the repository at this point in the history
If the socket is not found, the API server will not work correctly.
  • Loading branch information
gsanchietti committed Sep 27, 2023
1 parent 290ef95 commit 9916cf4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion api/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,16 @@ export CREDENTIALS_DIR="${CREDENTIALS_DIR:-/nethsecurity-api/credentials}"
export PROMTAIL_ADDRESS="${PROMTAIL_ADDRESS:-127.0.0.1}"
export PROMTAIL_PORT="${PROMTAIL_PORT:-9900}"

exec "$@"
socket=/etc/openvpn/run/mgmt.sock
limit=60
echo "Waiting for $socket to appear ..."
while [ ! -f "$socket" ]; do
sleep 1
limit=$((limit - 1))
if [ "$limit" -le 0 ]; then
echo "Socket not found!"
break
fi
done

exec "$@"

0 comments on commit 9916cf4

Please sign in to comment.