mirror of
https://github.com/nickyeoman/docker-compose-cookbooks.git
synced 2026-09-04 02:46:23 +00:00
Bookstack cleaned
This commit is contained in:
+2
-2
@@ -8,8 +8,8 @@ process_env_vars() {
|
||||
# Loop through each environment variable
|
||||
while IFS= read -r env_var; do
|
||||
# Split into name and value parts based on '='
|
||||
var_name="${env_var%%:*}" # Variable name (split by colon for YAML)
|
||||
var_value="${env_var#*: }" # Variable value (remove leading space)
|
||||
var_name="${env_var%%=*}" # Variable name
|
||||
var_value="${env_var#*=}" # Variable value
|
||||
|
||||
# Handle variables without existing braces (not previously processed)
|
||||
if [[ "$var_value" != *'${'* ]]; then
|
||||
|
||||
+2
-3
@@ -15,12 +15,11 @@ get_env_vars() {
|
||||
local compose_content="$1"
|
||||
local env_vars=""
|
||||
|
||||
# Use yq to extract the environment variables in 'key: value' format
|
||||
env_vars=$(echo "$compose_content" | yq eval '.services.*.environment | to_entries | .[] | "\(.key): \(.value)"' - 2>/dev/null)
|
||||
# Use yq to extract environment variables in 'key=value' format without indices
|
||||
env_vars=$(echo "$compose_content" | yq eval '.services.*.environment[]' - 2>/dev/null)
|
||||
|
||||
echo "$env_vars"
|
||||
}
|
||||
|
||||
get_image() {
|
||||
local compose_content="$1"
|
||||
local images=""
|
||||
|
||||
Reference in New Issue
Block a user