Skip to content

docs: document SMTP_* and other undocumented env vars - #1083

Merged
helpcodeai merged 4 commits into
HelpCode-ai:mainfrom
notlakshitha:docs/env-smtp-vars
Oct 25, 2026
Merged

helpcodeai merged 4 commits into
HelpCode-ai:mainfrom
notlakshitha:docs/env-smtp-vars

Conversation

@notlakshitha

Copy link
Copy Markdown

Summary

.env.example says the cloud host jobs "mail through the SMTP_* settings above", but it defines no SMTP_* variables. The backend reads seven of them, and docs/deployment.md lists only four. Several other variables the backend reads (KG_HASH_SECRET, KG_MCP_TOOL, KG_OBSERVE_COOLDOWN_SEC, SHUTDOWN_TIMEOUT_MS, SENTRY_MCP_TRACES_SAMPLE_RATE) are not documented anywhere. This PR documents them as agreed in #1049.

Changes

  • .env.example: add a commented Email (SMTP) block with all seven SMTP_* variables, placed above the cloud host jobs section that refers to it.
  • .env.example: add commented entries for KG_HASH_SECRET (noting it should be set explicitly in production rather than relying on the ENCRYPTION_KEY → JWT_SECRET → built-in fallback chain), KG_MCP_TOOL, KG_OBSERVE_COOLDOWN_SEC, SHUTDOWN_TIMEOUT_MS and SENTRY_MCP_TRACES_SAMPLE_RATE.
  • docs/deployment.md: add the seven SMTP_* variables to the Environment Variables table.

Names, defaults and behaviour were checked against the code that reads each variable: settings/email.service.ts, knowledge-graph/identifier.ts, mcp-server/mcp-endpoint.controller.ts, knowledge-graph/kg.service.ts, main.ts and instrument.ts.

Type

  • Documentation

Testing

  • No tests needed (documentation only; every new .env.example line is commented out)

From the repository root:

  • git diff --check: no whitespace errors.
  • set -a; . ./.env.example: sources without errors.

Checklist

  • My code follows the existing code style
  • I have updated documentation (if applicable)
  • This PR has a descriptive title

Related Issues

Closes #1049

Two related things I noticed but left out of scope: the default docker-compose.yml does not pass the SMTP_*, KG_*, SHUTDOWN_TIMEOUT_MS or Sentry variables into the app container, and SMTP_FROM_NAME is written by setup.sh and railway.json but not read by the backend. I'm happy to follow up on either if useful.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@notlakshitha

Copy link
Copy Markdown
Author

recheck

@helpcodeai

Copy link
Copy Markdown
Contributor

Thanks, this reads well and the defaults match the code. One thing for the CLA: "recheck" only re-runs the bot, it doesn't sign. Please post a comment with exactly this sentence:

I have read the CLA Document and I hereby sign the CLA

About the two things you left out. The compose one is actually a bug: setup.sh writes SMTP_* into .env, but the default docker-compose.yml never passes them to the app, so env SMTP silently doesn't work on a standard install. I'm fixing that one in a separate PR. For SMTP_FROM_NAME, if you want to pick it up as a follow-up, I'd rather the backend read it (sender name in SMTP_FROM when that isn't set) than drop it from setup.sh and railway.json.

@helpcodeai

Copy link
Copy Markdown
Contributor

Quick heads-up: the compose part you spotted is fixed on main now (#1084), so SMTP_* from .env reaches the app on a standard install. This PR is good to go as soon as the CLA is signed. It only needs a comment with the exact sentence "I have read the CLA Document and I hereby sign the CLA", since "recheck" alone doesn't record anything.

@Coding-Professional Coding-Professional left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cross-checked the added SMTP defaults and fallback precedence against EmailService, and checked the new knowledge-graph, shutdown and MCP tracing defaults against their readers. One small copy/paste issue below: I reproduced the shell syntax error with Bash -n and verified that quoting the value passes. No SMTP delivery test was run.

Comment thread .env.example Outdated
# SMTP_SECURE=false
# SMTP_USER=
# SMTP_PASS=
# SMTP_FROM=AnythingMCP <noreply@example.com>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the sender example quote its value, e.g. # SMTP_FROM="AnythingMCP <noreply@example.com>"? Uncommenting the current example produces SMTP_FROM=AnythingMCP <noreply@example.com>, which fails bash -n with a syntax error because the angle brackets are interpreted as redirection. This matters for the local-development path that sources .env before running Prisma. The commented template itself sources successfully, so the validation in the description would not catch this. The quoted form passes the same syntax check and preserves the intended display name.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, quoted it so it sources cleanly now 👍

@helpcodeai

Copy link
Copy Markdown
Contributor

@notlakshitha thanks for the SMTP_FROM quoting fix, good catch. The only thing still missing is the CLA: please post a comment with exactly this sentence and the check goes green, then I'll merge.

I have read the CLA Document and I hereby sign the CLA

@notlakshitha

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@helpcodeai

Copy link
Copy Markdown
Contributor

@notlakshitha thanks, and sorry for the extra round. Your comment didn't register with the CLA bot: it only matches when the comment is exactly that sentence, and yours had a couple of blank lines after it. Editing it won't help, so please post a new comment with only this line, nothing before or after:

I have read the CLA Document and I hereby sign the CLA

Once the check is green I'll update the branch and merge.

@notlakshitha

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Oct 24, 2026

@helpcodeai helpcodeai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @notlakshitha, CLA is green now. Merging.

@helpcodeai
helpcodeai enabled auto-merge (squash) October 25, 2026 08:22
@helpcodeai
helpcodeai merged commit 1b1b725 into HelpCode-ai:main Oct 25, 2026
13 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: document all SMTP_* and other undocumented env vars for self-hosting

3 participants