Skip to content

feat(postfix): POSTFIX_CONF_* env var convention for runtime config overrides#64

Merged
prim-8 merged 2 commits into
mainfrom
feat/postfix-conf-env-overrides
May 5, 2026
Merged

feat(postfix): POSTFIX_CONF_* env var convention for runtime config overrides#64
prim-8 merged 2 commits into
mainfrom
feat/postfix-conf-env-overrides

Conversation

@prim-8
Copy link
Copy Markdown
Contributor

@prim-8 prim-8 commented May 5, 2026

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 via postconf -e at startup, after the template is rendered.

Example: POSTFIX_CONF_DEFAULT_PROCESS_LIMIT=300postconf -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 -e blocks in entrypoint.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 before postfix start-fg, all overrides land in main.cf before Postfix reads it.

Test plan

  • Container starts cleanly with no POSTFIX_CONF_* vars set (loop exits without error via || true)
  • POSTFIX_CONF_DEFAULT_PROCESS_LIMIT=300 results in postconf default_process_limit returning 300
  • Multiple overrides apply independently

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 5, 2026

Greptile Summary

  • Adds a for name in "${!POSTFIX_CONF_@}" loop in milter/entrypoint.sh that lowercases each key and applies it via postconf -e, enabling runtime Postfix parameter overrides without a rebuild.
  • The block is correctly placed before the hardcoded TLS, IP-literal, and mynetworks postconf calls (lines 74–88), so those security-critical settings always win.
  • Uses native Bash prefix-expansion (${!POSTFIX_CONF_@}) rather than env | grep, avoiding the multi-line value parsing hazard flagged in earlier review threads.

Confidence Score: 5/5

This 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

Filename Overview
milter/entrypoint.sh Adds a POSTFIX_CONF_* env-var loop using native ${!POSTFIX_CONF_@} expansion, correctly placed before the hardcoded TLS/IP-literal/mynetworks overrides so those still take precedence.

Reviews (2): Last reviewed commit: "fix: move POSTFIX_CONF_* loop before TLS..." | Re-trigger Greptile

Comment thread milter/entrypoint.sh Outdated
Comment thread milter/entrypoint.sh Outdated
@prim-8 prim-8 merged commit 0faa8ef into main May 5, 2026
8 checks passed
@prim-8 prim-8 deleted the feat/postfix-conf-env-overrides branch May 5, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant