Skip to content

Commit

Permalink
refactor(docker-entrypoint.sh): improve env variable substitution by …
Browse files Browse the repository at this point in the history
…adding recursive directory processing
  • Loading branch information
ozeliurs committed Oct 8, 2024
1 parent d74ab2b commit 1e80ce9
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions react-frontend/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#!/bin/env bash

for file in /usr/share/nginx/html/*; do
if [ -f "$file" ]; then
envsubst < "$file" > "$file.tmp" && mv "$file.tmp" "$file"
fi
done
process_directory() {
for item in "$1"/*; do
if [ -f "$item" ]; then
envsubst < "$item" > "$item.tmp" && mv "$item.tmp" "$item"
elif [ -d "$item" ]; then
process_directory "$item"
fi
done
}

process_directory "/usr/share/nginx/html"

nginx -g "daemon off;"

0 comments on commit 1e80ce9

Please sign in to comment.