Skip to content

Generate env files from EJSON with local overrides - #580

Draft
kieran-osgood-shopify wants to merge 3 commits into
mainfrom
kieran-osgood/ejson-generate-env-files
Draft

Generate env files from EJSON with local overrides#580
kieran-osgood-shopify wants to merge 3 commits into
mainfrom
kieran-osgood/ejson-generate-env-files

Conversation

@kieran-osgood-shopify

@kieran-osgood-shopify kieran-osgood-shopify commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Stack Context

This PR is two phased with #582 to achieve: Local and E2E runs will now always run the same configs - no drift.

#580 generate .env from .ejson
#582 generate e2e/.env from ejson, use the e2e/.env in Bitrise, meaning we can delete all the secrets in the bitrise UI as they're sourced from ejson now, and developers can have the exact config of bitrise locally

Why?

Relying on sharing 1password files around was slow and prone to drift
We had no solution for running the same config as CI locally
The encrypted files provide one reviewable source for shared configuration
.env.local keeps personal overrides persistent across dev up runs.

The generator remains separate from setup_storefront_env, so public contributors do not need EJSON access and their hand-written .env remains untouched.

What?

  • .env and e2e/.env are now generated from committed encrypted EJSON files during dev up
  • Make scripts/setup_storefront_env read-only toward .env.
  • Apply .env.local as an override on top of the .env (last key wins)
  • ** Preserves existing .env by migrating it to .env.local**

For outside contributors the workflow remains the same, copy .env.example to .env, fill it in, and run the samples

Also noticed there was some --skip-optional-prompts that are stale/were removed recently so did some clean up

How to test

run: dev up

You should now see the following changes:
your existing .env will be copied to .env.local
.env has been generated from the stored config/secrets/demo.ejson
e2e/.env generated from config/secrets/e2e.ejson

Compare the .env and .env.local - consider whether you need the .local overrides and remove unnecessary overrides to receive same config as the rest of the team

@github-actions github-actions Bot added the #gsd:50662 Rebase Checkout Kit on UCP label Aug 5, 2026
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/env-local-overlay branch from a2ee887 to a02421c Compare August 5, 2026 11:06
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/ejson-generate-env-files branch 2 times, most recently from 1aa2ce8 to 25fe0a4 Compare August 5, 2026 11:35
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/env-local-overlay branch 2 times, most recently from 131eb0a to eba4266 Compare August 5, 2026 11:45
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/ejson-generate-env-files branch from 25fe0a4 to acf432e Compare August 5, 2026 11:45
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/env-local-overlay branch from eba4266 to e94d61b Compare August 5, 2026 12:33
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/ejson-generate-env-files branch 4 times, most recently from 9cddd46 to 16e70ad Compare August 7, 2026 11:05
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/env-local-overlay branch 2 times, most recently from 6c4b15a to 6d1b182 Compare August 7, 2026 11:27
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/ejson-generate-env-files branch from 16e70ad to 70b94be Compare August 7, 2026 11:28
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/env-local-overlay branch from 6d1b182 to f69378a Compare August 7, 2026 13:51
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/ejson-generate-env-files branch 2 times, most recently from 9bf0306 to d4951e0 Compare August 7, 2026 14:15
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/env-local-overlay branch from 508a790 to ab0ce29 Compare August 7, 2026 15:41
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/ejson-generate-env-files branch from d4951e0 to 0041792 Compare August 7, 2026 15:41
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/env-local-overlay branch from ab0ce29 to 4f132b4 Compare August 10, 2026 09:08
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/ejson-generate-env-files branch from 0041792 to 191de7a Compare August 10, 2026 09:08
@kieran-osgood-shopify kieran-osgood-shopify changed the title Generate .env from ejson instead of writing it Generate env files from EJSON with local overrides Aug 12, 2026
@@ -0,0 +1,38 @@
appId: ${E2E_APP_ID}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Looks like a restack gone wrong as all these shouldn't be part of this stack - this looks like the work from #562 which got closed

@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/ejson-generate-env-files branch from 329ae4f to f0bbb0f Compare August 14, 2026 16:24
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/e2e-checkout-guest branch from df7a799 to 81de4d9 Compare August 17, 2026 12:51
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/ejson-generate-env-files branch 2 times, most recently from 854b848 to 9039d2b Compare August 17, 2026 13:13
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/e2e-checkout-guest branch 2 times, most recently from 7238234 to 111f3ea Compare August 18, 2026 09:27
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/ejson-generate-env-files branch from 9039d2b to 0cfc1a6 Compare August 18, 2026 09:27
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/e2e-checkout-guest branch 2 times, most recently from ee190fc to 4d3d211 Compare August 18, 2026 10:25
@kieran-osgood-shopify
kieran-osgood-shopify changed the base branch from kieran-osgood/e2e-checkout-guest to graphite-base/580 August 19, 2026 10:51
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/ejson-generate-env-files branch from 0cfc1a6 to cfd107d Compare August 20, 2026 18:09
@kieran-osgood-shopify
kieran-osgood-shopify changed the base branch from graphite-base/580 to main August 20, 2026 18:09
setup_storefront_env took the first match for a duplicated key while
run_maestro took the last. Last-wins is the predictable rule: in a file kept
by hand, the last uncommented assignment is the active one.

.env.local now overrides .env per key. Nothing writes to .env.local, so it
survives every sync and gives a developer a place to point the sample apps at
their own store.

Write decisions about .env deliberately ignore the overlay. Resolved values
carry overrides, so writing them back would make an override permanent. While
.env.local exists, .env is left alone and the reason is reported.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/ejson-generate-env-files branch from cfd107d to e017ab2 Compare August 21, 2026 10:59
scripts/generate_env_files decrypts config/secrets/*.ejson into .env and
e2e/.env, so setup_storefront_env becomes read-only towards .env. A developer
who keeps their own store in .env.local now keeps it: nothing overwrites the
file that a sync used to rewrite.

The two optional prompt flags go away with the writing. CI callers already
supply their values through the process environment, so they only needed the
flag to suppress a prompt that no longer exists.

scripts/migrate_env_to_local preserves a hand-written .env as .env.local on the
first `dev up` after this change.

STOREFRONT_MERCHANT_IDENTIFIER leaves the shared storefront config: it belongs
beside each sample app's own Apple Pay entitlement.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Assisted-By: devx/252dfd24-6c25-4bb4-8463-27702ec564eb
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/ejson-generate-env-files branch from e017ab2 to 1c51847 Compare August 21, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

#gsd:50662 Rebase Checkout Kit on UCP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant