Skip to content

Allow shared example secrets/config to be sourced from env vars#3817

Open
malewis5 wants to merge 1 commit into
Shopify:previewfrom
vercel-labs:mttlws/secrets-fix
Open

Allow shared example secrets/config to be sourced from env vars#3817
malewis5 wants to merge 1 commit into
Shopify:previewfrom
vercel-labs:mttlws/secrets-fix

Conversation

@malewis5

Copy link
Copy Markdown

What

Updates the shared example helpers so the storefront token and config can be supplied via environment variables, falling back to the existing committed/decrypted values when env vars aren't set.

  • examples/shared/config.ts: add a small readEnv() helper and source storeDomain / publicStorefrontToken from PUBLIC_STORE_DOMAIN / PUBLIC_STOREFRONT_API_TOKEN when present, falling back to the hydrogen-preview defaults.
  • examples/shared/private-env.ts: getSharedSecret() now falls back to process.env[key] when the value isn't found in the decrypted secrets module, so the private token can be provided via env. Simplified the missing-token error message accordingly.

Why

Lets the shared examples run with credentials injected through the environment (e.g. in CI or hosted deployments) without requiring the EJSON secrets file to be decrypted locally, while keeping the existing committed defaults working out of the box.

Notes

Scope is limited to the two examples/shared/* files — no behavior change when env vars are unset.

@malewis5 malewis5 requested a review from a team as a code owner June 24, 2026 18:21
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