refactor: Helper function `_replace_by_env_in_file()` by polarathene · Pull Request #3526 · docker-mailserver/docker-mailserver
added 2 commits
September 4, 2023 11:48Minor change to add support for usage with `saslauthd.conf` which differs with `:` for it's key/value delimiter. Also adopts the`_escape_for_sed()` method, instead of the inline sed pattern (_which for some reason escaped `=` but not `(` + `)`, thus buggy if ever matching on input with those tokens_). `_escape_for_sed()` likewise wasn't escaping for `(` + `)` or even `|`, which are required for proper escape support if using `sed -E` / `sed -r` with this method. Additionally added escaping support for `&` replacement segment token, which seems valid. Increased verbosity to better grok pattern matching expression, clarified escaping concern with `sed` delimiter since the project is not consistent there.
No need to check for a non-empty value to prepend a space (_since an empty value is used via sed anyway?_). Can also be a bit DRY with the sed pattern, matching the key + delimiter (_and all white-space before/after the delimiter until the value_), then capture that for the replacement left-side value while only actually swapping the value for the ENV input value. Should be an improvement, unless there is a scenario that would differ between `` and ` ` as valid value assignments?
github-actions
bot
added
the
meta/stale
label
Oct 2, 2023
polarathene
added
stale-bot/ignore
and removed meta/stale
This issue / PR has become stale and will be closed if there is no further activitylabels
Oct 2, 2023This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters