-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess-env.sh
More file actions
32 lines (23 loc) · 855 Bytes
/
process-env.sh
File metadata and controls
32 lines (23 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# Script for processing environment variables in configuration files
# Save this as process-env.sh in your project root directory
# Function to replace environment variables in a file
process_env_vars() {
local file=$1
local temp_file="${file}.tmp"
# Create a copy of the original file
cp "$file" "$temp_file"
# Replace all ${VAR} occurrences with their values
envsubst < "$temp_file" > "$file"
# Remove temporary file
rm "$temp_file"
echo "Processed environment variables in $file"
}
# Process all configuration files
process_env_vars "./prometheus/prometheus.yml"
process_env_vars "./alertmanager/alertmanager.yml"
process_env_vars "./telegraf/telegraf.conf"
# Add more files as needed
echo "All configuration files processed"
# If this script is used as an entrypoint, execute the passed command
exec "$@"