This commit is contained in:
@@ -19,6 +19,11 @@ fi
|
||||
tmp_output="$(mktemp)"
|
||||
trap 'rm -f "$tmp_output"' EXIT
|
||||
|
||||
target_mode="640"
|
||||
if [ -f "$env_file" ]; then
|
||||
target_mode="$(stat -c '%a' "$env_file" 2>/dev/null || printf '640')"
|
||||
fi
|
||||
|
||||
if [ -f "$env_file" ]; then
|
||||
awk '
|
||||
function key_from(line, key) {
|
||||
@@ -74,4 +79,5 @@ if [ -n "$session_secret" ] && grep -q '^SESSION_SECRET=$' "$tmp_output"; then
|
||||
sed -i "s/^SESSION_SECRET=$/SESSION_SECRET=$session_secret/" "$tmp_output"
|
||||
fi
|
||||
|
||||
mv "$tmp_output" "$env_file"
|
||||
cat "$tmp_output" > "$env_file"
|
||||
chmod "$target_mode" "$env_file"
|
||||
|
||||
Reference in New Issue
Block a user