Allow shared example secrets/config to be sourced from env vars#3817
Open
malewis5 wants to merge 1 commit into
Open
Allow shared example secrets/config to be sourced from env vars#3817malewis5 wants to merge 1 commit into
malewis5 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 smallreadEnv()helper and sourcestoreDomain/publicStorefrontTokenfromPUBLIC_STORE_DOMAIN/PUBLIC_STOREFRONT_API_TOKENwhen present, falling back to thehydrogen-previewdefaults.examples/shared/private-env.ts:getSharedSecret()now falls back toprocess.env[key]when the value isn't found in the decryptedsecretsmodule, 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.