Skip to content

Expose SMTP vars so they appear in Coolify's env-var UI#3

Merged
lunarthegrey merged 1 commit into
mainfrom
expose-mail-vars-to-coolify
Apr 22, 2026
Merged

Expose SMTP vars so they appear in Coolify's env-var UI#3
lunarthegrey merged 1 commit into
mainfrom
expose-mail-vars-to-coolify

Conversation

@lunarthegrey
Copy link
Copy Markdown

Summary

  • patch.py now injects mail__transport, mail__options__host, mail__options__port, mail__options__secure, mail__options__auth__user, mail__options__auth__pass, and mail__from into the ghost service's environment: block as explicit ${mail__*:-default} refs.
  • test-patch.sh gets three sentinel assertions.
  • README step 3 updated from "set SMTP env vars" → "fill in the pre-listed SMTP rows".

Why

Coolify's env-var UI auto-populates from ${FOO} substitutions inside compose.yml. Upstream hands mail settings to Ghost via env_file: - .env, which Coolify doesn't scan — so users deploying the stack had to manually create each SMTP row in the Coolify UI before the deploy would send email. Surfaced live when I deployed to my Coolify instance: no mail rows in the UI.

The explicit environment: entries win over env_file at Docker Compose precedence, so bare-metal users who populate .env via migrate.sh are unaffected — Docker Compose reads the project .env for substitution and the mail values propagate the same way.

Defaults

Key Default
mail__transport SMTP
mail__options__port 465
mail__options__secure true
mail__options__host / auth__user / auth__pass / mail__from empty

Empty host/auth means Ghost boots but mail-sending flows (staff invites, password resets) fail until the user fills them in — not a regression over the prior behavior.

Test plan

  • bash .github/scripts/test-patch.sh passes — sentinel rows present, idempotency clean
  • shellcheck .github/scripts/test-patch.sh clean
  • After merge + sync: redeploy in Coolify, confirm mail rows appear pre-listed in Environment Variables tab
  • Fill in SMTP values, send a test email via Ghost admin → verify delivery

🤖 Generated with Claude Code

Coolify's env-var scanner reads only \${...} substitutions in
compose.yml, not env_file contents. Upstream passes mail__* via
`env_file: - .env`, so users had to hand-create each row in the
Coolify UI before deploying.

patch.py now injects explicit `mail__transport: ${mail__transport:-SMTP}`
(and six sibling entries) into the ghost service's environment block.
Coolify surfaces them as pre-listed rows — users just fill in the
values instead of having to know the keys upfront.

Defaults: SMTP transport, port 465, secure=true. Host / auth / from
default to empty strings; Ghost boots without them, only mail-sending
flows fail until the user fills them in.

test-patch.sh asserts the three sentinel entries are present.
README.coolify.md deploy step 3 updated to reflect "fill in" vs "add
from scratch".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lunarthegrey lunarthegrey merged commit 3a97827 into main Apr 22, 2026
2 checks passed
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