chore: Adopt `sedfile` + case-insensitive pattern matching

Both should be improvements for usage

Co-authored-by: Casper <casperklein@users.noreply.github.com>
This commit is contained in:
Brennan Kinney 2023-09-11 20:02:55 +12:00 committed by GitHub
parent 01f7db0965
commit 39fb585bfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -130,7 +130,7 @@ function _replace_by_env_in_file() {
ESCAPED_KEY=$(_escape_for_sed "${KEY,,}")
ESCAPED_VALUE=$(_escape_for_sed "${VALUE}")
_log 'trace' "Setting value of '${KEY}' in '${CONFIG_FILE}' to '${VALUE}'"
sed -i -E "s#^(${ESCAPED_KEY}[[:space:]]*${KV_DELIMITER}[[:space:]]*).*#\1${ESCAPED_VALUE}#g" "${CONFIG_FILE}"
sedfile -i -E "s#^(${ESCAPED_KEY}[[:space:]]*${KV_DELIMITER}[[:space:]]*).*#\1${ESCAPED_VALUE}#gi" "${CONFIG_FILE}"
done < <(env | grep "^${ENV_PREFIX}")
}