Skip to content

Fix: gracefully handle missing optional env vars for Helm/Kubernetes (#186)#196

Open
AnthonyGeorgeAZ wants to merge 4 commits into
Grashjs:mainfrom
AnthonyGeorgeAZ:fix/186-optional-env-vars
Open

Fix: gracefully handle missing optional env vars for Helm/Kubernetes (#186)#196
AnthonyGeorgeAZ wants to merge 4 commits into
Grashjs:mainfrom
AnthonyGeorgeAZ:fix/186-optional-env-vars

Conversation

@AnthonyGeorgeAZ
Copy link
Copy Markdown

Problem

When using Helm to deploy, optional env vars set to empty strings in values.yaml get stripped by Kubernetes so the container never sees them. This caused two issues:

  1. The app would error on missing vars
  2. Operators worked around it by setting vars to "-" which then got passed as a real tracking ID or reCAPTCHA key, causing subtle bugs

Changes

  • frontend/src/config.tsgetRuntimeValue now trims values and treats empty strings, "-" and "disabled" as not configured
  • README.MD — added a note for Helm/Kubernetes operators explaining to omit optional vars rather than set them to empty strings

Testing

  • Optional var set to "" in Helm → app starts normally
  • Optional var set to "-" → treated as not configured
  • Valid value set → works as before

Fixes #186

…optional env vars gracefully in getRuntimeValue (Grashjs#186)

   Trim envValue and treat empty string, "-" and "disabled" as undefined so absent Helm/Kubernetes env vars don't cause crashes or subtle bugs.
Explains to Helm/Kubernetes operators that optional variables should be omitted rather than set to empty strings, and warns against using "-" as a sentinel value.
@netlify
Copy link
Copy Markdown

netlify Bot commented May 3, 2026

👷 Deploy request for atlasjs-home pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 43132f7

@netlify
Copy link
Copy Markdown

netlify Bot commented May 3, 2026

👷 Deploy request for atlas-cmms pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 43132f7

…defined (Grashjs#186)

getRuntimeValue can now return undefined for absent vars. Fixed two exported constants typed as string that were not handling the undefined case.
…shjs#186)

INVITATION_VIA_EMAIL, ENABLE_EMAIL_NOTIFICATIONS and OAUTH2_PROVIDER had no defaults, causing Spring Boot to fail on startup when deployed via Helm/Kubernetes where empty env vars are stripped entirely.
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.

Gracefully handle missing optional environment variables for Helm/Kubernetes support

1 participant