Skip to content

Commit

Permalink
fix: Write os-var replaced .src file to temp file, and rename
Browse files Browse the repository at this point in the history
The replace_os_vars function is called for any command, not only those that boot the release. If you invoke <release> status in a readiness check, that will write the file again.

This might lead to race conditions, where the release starts up, but the health check will re-render the sys.config and write it halfway while the boot gets around to read it.
  • Loading branch information
chsukivra authored May 23, 2024
1 parent bacc278 commit 1a8f4e0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion priv/templates/extended_bin
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ make_out_file_path() {

# Replace environment variables
replace_os_vars() {
TEMP_OUT=$(mktemp "$2".XXXXX)
awk '{
while(match($0,"[$]{[^}]*}")) {
var=substr($0,RSTART+2,RLENGTH -3)
Expand All @@ -460,7 +461,8 @@ replace_os_vars() {
gsub("[$]{"var"}",e)
}
}
}1' < "$1" > "$2"
}1' < "$1" >> "$TEMP_OUT"
mv "$TEMP_OUT" "$2"
}

add_path() {
Expand Down

0 comments on commit 1a8f4e0

Please sign in to comment.