You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've searched existing issues and this isn't a duplicate.
This is a reproducible bug in Calnode — not a configuration/setup question or a feature request.
What's the bug?
Despite the documentation suggesting otherwise, certain variables are fetched from the DB even if differing env vars exist. Calnode should always pick the env vars as the one with higher precedence.
Steps to reproduce
Deploy Calnode with env vars
Change email related env vars
redeploy
notice that it has not changed in the ui
Short version: intended precedence, real silent-failure bug. Please don't flip the precedence — but you're right that it shouldn't be silent.
Email and Google OAuth settings live in the database, and those stored values win over the environment. On first boot the env vars are seeded into the database (seedSMTPToDB only writes WHERE smtp_host = ''), so changing EMAIL_SMTP_* and redeploying afterwards has no effect. That's deliberate: Settings → Email is the live, UI-editable source of truth, and a stale env var overriding a deliberate UI change on the next restart would be worse than the current behaviour.
What was genuinely wrong is that nothing told you. Opened #239 for that:
DEPLOY.md now states the precedence above the env table, and the SMTP/Google rows say they seed the database rather than "can also be set later".
Boot logs a warning naming every variable it is ignoring:
WARN mailer: ignoring environment settings — the database configuration takes
precedence; change it in Settings → Email, or clear the stored settings
there to fall back to the environment ignored=[EMAIL_SMTP_HOST]
Workaround until it lands: clear the SMTP host in Settings → Email (or the Google credentials in Settings → Google) and restart. With the stored value empty, the env vars are read and re-seed it.
If you'd still like to contribute, a PR improving the docs or the warning is very welcome — but inverting the precedence would break UI-editable settings, so that part we'd have to decline.
I still think we should flip the precedence, like many other projects do. My implementation was conditional anyways, such that the env is only preferred if all the variables of a group are complete, and otherwise it picks whatever is stored in the db.
Your conditional design is a genuine improvement over a naive flip — "all variables of a group present, otherwise use the DB" removes the half-configured case (env host with no password), which is the dangerous one. I want to acknowledge that properly, because my objection isn't to how you'd implement it.
It's to what the default would mean. Under env-wins, an operator who sets SMTP in Settings → Email — the thing the UI exists for — gets silently overridden on the next restart by whatever the compose file still says. That's the same silent surprise you reported, just pointing the other way. And "many other projects do it" is fair, but those are usually stateless apps where env is the config; Calnode's settings are mutable at runtime, so the two sources genuinely compete.
So the decision, for now: DB-wins stays the default, and #239 lands to make the override visible. That closes the bug you actually hit — it's no longer silent — without changing which source is authoritative.
But I'd take your version as an explicit mode. If you want to build it:
env — your rule: prefer a group's env values only when the group is complete, else fall back to the DB, and warn when the stored value is the one being shadowed.
That gives you the 12-factor behaviour you want without making it a surprise for everyone else, and your group-completeness logic is exactly the right implementation for the env mode — I wouldn't rewrite it.
If that's something you'd like to pick up, say so and I'll open an issue for it with the above as the spec. Otherwise #239 is the fix for the reported symptom.
One practical note regardless: the workaround today is to clear the SMTP host in Settings → Email and restart, at which point the env vars are read and re-seed the database.
Activity
pullfrog commentedon Nov 7, 2026
M4dhav commentedon Nov 7, 2026
I am ready to open the PR for this, please lmk if this is indeed a bug and not intended
shockalotti commentedon Nov 7, 2026
Short version: intended precedence, real silent-failure bug. Please don't flip the precedence — but you're right that it shouldn't be silent.
Email and Google OAuth settings live in the database, and those stored values win over the environment. On first boot the env vars are seeded into the database (
seedSMTPToDBonly writesWHERE smtp_host = ''), so changingEMAIL_SMTP_*and redeploying afterwards has no effect. That's deliberate: Settings → Email is the live, UI-editable source of truth, and a stale env var overriding a deliberate UI change on the next restart would be worse than the current behaviour.What was genuinely wrong is that nothing told you. Opened #239 for that:
DEPLOY.mdnow states the precedence above the env table, and the SMTP/Google rows say they seed the database rather than "can also be set later".Workaround until it lands: clear the SMTP host in Settings → Email (or the Google credentials in Settings → Google) and restart. With the stored value empty, the env vars are read and re-seed it.
If you'd still like to contribute, a PR improving the docs or the warning is very welcome — but inverting the precedence would break UI-editable settings, so that part we'd have to decline.
M4dhav commentedon Nov 9, 2026
I still think we should flip the precedence, like many other projects do. My implementation was conditional anyways, such that the env is only preferred if all the variables of a group are complete, and otherwise it picks whatever is stored in the db.
shockalotti commentedon Nov 9, 2026
Your conditional design is a genuine improvement over a naive flip — "all variables of a group present, otherwise use the DB" removes the half-configured case (env host with no password), which is the dangerous one. I want to acknowledge that properly, because my objection isn't to how you'd implement it.
It's to what the default would mean. Under env-wins, an operator who sets SMTP in Settings → Email — the thing the UI exists for — gets silently overridden on the next restart by whatever the compose file still says. That's the same silent surprise you reported, just pointing the other way. And "many other projects do it" is fair, but those are usually stateless apps where env is the config; Calnode's settings are mutable at runtime, so the two sources genuinely compete.
So the decision, for now: DB-wins stays the default, and #239 lands to make the override visible. That closes the bug you actually hit — it's no longer silent — without changing which source is authoritative.
But I'd take your version as an explicit mode. If you want to build it:
db— today's behaviour, with the fix(config): document and warn when stored settings shadow env vars (#238) #239 warning when env is being ignored.env— your rule: prefer a group's env values only when the group is complete, else fall back to the DB, and warn when the stored value is the one being shadowed.That gives you the 12-factor behaviour you want without making it a surprise for everyone else, and your group-completeness logic is exactly the right implementation for the
envmode — I wouldn't rewrite it.If that's something you'd like to pick up, say so and I'll open an issue for it with the above as the spec. Otherwise #239 is the fix for the reported symptom.
One practical note regardless: the workaround today is to clear the SMTP host in Settings → Email and restart, at which point the env vars are read and re-seed the database.
Merge pull request #239 from Calnode/fix/env-var-precedence-docs
fix(config): document and warn when stored settings shadow env vars (C…