Fix entrypoint to regenerate config when env vars are updated
When PROBOD_ENCRYPTION_KEY is set, always run probod-bootstrap to regenerate the config file. This ensures that updated environment variables take effect even when a stale config file exists on a persistent volume (e.g., PVC). Previously, an existing config file would be reused unconditionally, causing env var changes to be ignored on container restart. Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -4,13 +4,18 @@ set -e
|
|||||||
# Configuration file path
|
# Configuration file path
|
||||||
CONFIG_FILE="${CONFIG_FILE:-/etc/probod/config.yml}"
|
CONFIG_FILE="${CONFIG_FILE:-/etc/probod/config.yml}"
|
||||||
|
|
||||||
# Check if config file already exists (e.g., mounted from ConfigMap)
|
# If bootstrap env vars are set, always (re)generate the config from them.
|
||||||
if [ -f "$CONFIG_FILE" ]; then
|
# This ensures that updated env vars take effect even when a stale config
|
||||||
|
# file exists on a persistent volume. When no env vars are present, fall
|
||||||
|
# back to an existing config file (e.g., mounted from a ConfigMap).
|
||||||
|
if [ -n "$PROBOD_ENCRYPTION_KEY" ]; then
|
||||||
|
echo "Generating configuration file from environment variables at: $CONFIG_FILE"
|
||||||
|
probod-bootstrap -output "$CONFIG_FILE"
|
||||||
|
elif [ -f "$CONFIG_FILE" ]; then
|
||||||
echo "Using existing configuration file at: $CONFIG_FILE"
|
echo "Using existing configuration file at: $CONFIG_FILE"
|
||||||
else
|
else
|
||||||
echo "Generating configuration file from environment variables at: $CONFIG_FILE"
|
echo "Error: no bootstrap env vars set and no config file found at $CONFIG_FILE" >&2
|
||||||
# Generate configuration from environment variables
|
exit 1
|
||||||
probod-bootstrap -output "$CONFIG_FILE"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Execute probod with the generated config
|
# Execute probod with the generated config
|
||||||
|
|||||||
Reference in New Issue
Block a user