feat(postfix): POSTFIX_CONF_* env var convention for runtime config overrides#64
Merged
Conversation
Contributor
Greptile Summary
Confidence Score: 5/5This PR is safe to merge — the implementation is correct and the concerns from earlier review rounds have been addressed. No P0 or P1 findings. The two issues raised in prior threads (ordering vs. hardcoded overrides, and env | grep fragility) are both resolved in this revision: the loop uses ${!POSTFIX_CONF_@} and is placed before the TLS/mynetworks blocks. No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "fix: move POSTFIX_CONF_* loop before TLS..." | Re-trigger Greptile |
This 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a general-purpose runtime override mechanism for Postfix config parameters. Any
POSTFIX_CONF_<PARAM>=<value>env var set on the container is applied viapostconf -eat startup, after the template is rendered.Example:
POSTFIX_CONF_DEFAULT_PROCESS_LIMIT=300→postconf -e "default_process_limit=300"Motivation
Without this, every Postfix tuning change (process limits, rate limits, timeouts) requires a submodule PR + image rebuild. With it, deployers can inject any parameter from their own config (ECS task definition env vars, Terraform, etc.) without touching this repo.
How it works
After all the existing
postconf -eblocks inentrypoint.sh, a loop iterates over env vars matching^POSTFIX_CONF_, strips the prefix, lowercases the key, and applies it. Existing hardcoded overrides (TLS paths, mynetworks, IP literal) are unchanged and still take precedence if they run after this block — but since this block runs beforepostfix start-fg, all overrides land inmain.cfbefore Postfix reads it.Test plan
POSTFIX_CONF_*vars set (loop exits without error via|| true)POSTFIX_CONF_DEFAULT_PROCESS_LIMIT=300results inpostconf default_process_limitreturning300