28 lines
884 B
Bash
Executable File
28 lines
884 B
Bash
Executable File
#!/bin/bash
|
|
# Entrypoint script for LWVWV subscriber container
|
|
# Parses ../env (Perl format) and exports variables as environment variables
|
|
# Then executes the main command
|
|
|
|
ENV_FILE="/app/env"
|
|
|
|
if [ -f "$ENV_FILE" ]; then
|
|
echo "Loading configuration from $ENV_FILE..."
|
|
while IFS= read -r line || [ -n "$line" ]; do
|
|
# Skip empty lines and comments
|
|
[[ -z "$line" || "$line" =~ ^# ]] && continue
|
|
|
|
# Parse Perl format: $VAR = "value" or $VAR = "value";
|
|
if [[ $line =~ ^\$([A-Za-z_][A-Za-z0-9_]*)[[:space:]]*=[[:space:]]*\"([^\"]*)\"[[:space:]]*\;?$ ]]; then
|
|
varname="${BASH_REMATCH[1]}"
|
|
varvalue="${BASH_REMATCH[2]}"
|
|
export "$varname=$varvalue"
|
|
fi
|
|
done < "$ENV_FILE"
|
|
echo "Configuration loaded successfully"
|
|
else
|
|
echo "Warning: $ENV_FILE not found"
|
|
fi
|
|
|
|
# Execute the main command
|
|
exec "$@"
|