Skip to content

fix(vscode): bake production server URL and Stripe key into the VSIX - #1347

Merged
kwit75 merged 2 commits into
developfrom
fix/vscode-prod-env-vars
Jun 24, 2026
Merged

kwit75 merged 2 commits into
developfrom
fix/vscode-prod-env-vars

Conversation

@dsapandora

@dsapandora dsapandora commented Jun 24, 2026 •

Copy link
Copy Markdown
Collaborator
Captura de pantalla 2026-06-24 a las 10 34 50

Summary

  • The published VS Code extension was baked with the .config dev defaults (ROCKETRIDE_URI=http://localhost:5565, RR_STRIPE_PUBLISHABLE_KEY=pk_test_…) because getenv() only read .config/.env and ignored real environment variables — and CI has no .env, so production values could never be injected.
  • getenv() now honors process.env with precedence .config -> .env -> process.env, for known keys only and ignoring empty values (a set-but-empty CI secret falls back to the committed default instead of baking an empty string).
  • The Build step exposes ROCKETRIDE_URI and RR_STRIPE_PUBLISHABLE_KEY from repo variables, scoped to the step so the Test step keeps the localhost defaults and integration tests do not hit production.

Type

fix

Testing

  • Tests added or updated
  • Tested locally
  • ./builder test passes

Verified getenv() precedence locally: dev (no env) → localhost / pk_test; with real env → https://api.rocketride.ai / pk_live; set-but-empty → falls back to the .config default.

Checklist

  • Commit messages follow conventional commits
  • No secrets or credentials included
  • Wiki updated (if applicable)
  • Breaking changes documented (if applicable)

Deployment note

Requires two repo variables to be created (public, non-secret values):

  • ROCKETRIDE_URI=https://api.rocketride.ai
  • RR_STRIPE_PUBLISHABLE_KEY=pk_live_…

Linked Issue

No linked issue — to be added.

Summary by CodeRabbit

  • New Features

    • Added two build-time environment variables to the deployment workflow for app and payment configuration.
  • Bug Fixes

    • Improved environment resolution so real runtime values take priority over config and local env.
    • Runtime values that are empty strings are now ignored to prevent accidental overrides.

getenv() now honors real environment variables (precedence
.config -> .env -> process.env), for known keys only and ignoring
empty values. The Build step exposes ROCKETRIDE_URI and
RR_STRIPE_PUBLISHABLE_KEY from repo variables, scoped to the step so
the Test step keeps the localhost defaults.

Requires repo variables ROCKETRIDE_URI and RR_STRIPE_PUBLISHABLE_KEY.
@github-actions github-actions Bot added ci/cd CI/CD and build system builder Node builder tooling and ./builder workflows labels Jun 24, 2026
@coderabbitai

coderabbitai Bot commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Two build-time environment variables are added to the workflow, and getenv() now lets non-empty process.env values override .config and .env values.

Changes

Environment variable wiring and merge semantics

Layer / File(s) Summary
getenv.js: process.env final-winner merge
scripts/lib/getenv.js
Comment updated to describe the new .config -> .env -> process.env precedence. The merge now starts from .config and .env, then overrides each merged key with process.env only when the value is defined and non-empty.
CI build step: inject ROCKETRIDE_URI and RR_STRIPE_PUBLISHABLE_KEY
.github/workflows/_build.yaml
ROCKETRIDE_URI and RR_STRIPE_PUBLISHABLE_KEY from vars.* are added to the Build job step environment.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • jmaionchi
  • stepmikhaylov
  • Rod-Christensen

Poem

🐇 I hopped through config, env, and wind,
Then process.env won at the end.
Two build-time keys now join the ride,
With rabbit-approved values tucked inside.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: baking production URL and Stripe key into the VSIX for the VS Code extension.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/vscode-prod-env-vars

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor
🤖 Internal: Discord sync marker

Auto-managed by the Discord notification workflow. Stores the linked Discord message ID. Do not edit or delete.

Comment thread scripts/lib/getenv.js Resolved

@kwit75 kwit75 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed — getenv() .config->.env->process.env precedence is correct + safe: the override loops over already-merged keys only (no arbitrary process.env leaks into the VSIX) and skips empty values (a blank CI var falls back to the committed default, not an empty bake). Build-step var scoping keeps Test on localhost. The repo vars ROCKETRIDE_URI (api.rocketride.ai) + RR_STRIPE_PUBLISHABLE_KEY (pk_live) are already set to prod, so a fresh VSIX will bake prod. LGTM.

@kwit75
kwit75 enabled auto-merge (squash) June 24, 2026 17:36
@kwit75
kwit75 merged commit 320a5cf into develop Jun 24, 2026
26 checks passed
@kwit75
kwit75 deleted the fix/vscode-prod-env-vars branch June 24, 2026 17:46
AviNormie pushed a commit to AviNormie/rocketride-server that referenced this pull request Nov 9, 2026
…ocketride-org#1347)

* fix(vscode): bake production server URL and Stripe key into the VSIX

getenv() now honors real environment variables (precedence
.config -> .env -> process.env), for known keys only and ignoring
empty values. The Build step exposes ROCKETRIDE_URI and
RR_STRIPE_PUBLISHABLE_KEY from repo variables, scoped to the step so
the Test step keeps the localhost defaults.

Requires repo variables ROCKETRIDE_URI and RR_STRIPE_PUBLISHABLE_KEY.

* refactor(vscode): use for-in to iterate merged env keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builder Node builder tooling and ./builder workflows ci/cd CI/CD and build system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants