25 lines
759 B
Bash
25 lines
759 B
Bash
#!/bin/sh
|
|
|
|
CERT_PATH="/certs/crt.pem"
|
|
CA_PATH="/certs/ca.pem"
|
|
|
|
# Create the directory if it doesn't exist
|
|
mkdir -p "$(dirname "$CERT_PATH")" "$(dirname "$CA_PATH")"
|
|
|
|
if [ -n "$HAPROXY_PEM_CERT" ]; then
|
|
printf "%s" "$HAPROXY_PEM_CERT" > "$CERT_PATH"
|
|
chmod 600 "$CERT_PATH"
|
|
echo "HAProxy SSL certificate written to $CERT_PATH"
|
|
else
|
|
echo "Warning: HAPROXY_PEM_CERT environment variable is not set. SSL may not be configured."
|
|
fi
|
|
|
|
if [ -n "$HAPROXY_PEM_CA" ]; then
|
|
printf "%s" "$HAPROXY_PEM_CA" > "$CA_PATH"
|
|
chmod 600 "$CA_PATH" # Set restrictive permissions
|
|
echo "HAProxy SSL CA written to $CA_PATH"
|
|
else
|
|
echo "Warning: HAPROXY_PEM_CA environment variable is not set. SSL may not be configured."
|
|
fi
|
|
|
|
exec /usr/local/bin/docker-entrypoint.sh "$@"
|