Conversation
Load the project .env in src/cli.js so that AEM_* variables reach the commands, and resolve the da.live admin host from AEM_DA_ADMIN with https://admin.da.live as the default. Variables already present in the real environment keep precedence over the .env file, and .env is now git ignored.
Replace the hardcoded IMS origin, client id and scope in da-auth.js with values resolved from AEM_DA_IMS_ORIGIN, AEM_DA_IMS_CLIENT_ID and AEM_DA_IMS_SCOPE, each defaulting to today's prod value when unset, and key the cached token file by an environment label derived from the resolved DA admin host. The default host keeps the unchanged .hlx/.da-token.json name, so no token migrates; every other host gets its own .hlx/.da-token-<label>.json, and the git ignore entry is now the glob .hlx/.da-token*.json.
clone records the admin host it cloned from in .da-config.json. push compares that host with the resolved target host: a push to another backend is a copy, not a sync, so the source baseline no longer applies. On a backend mismatch push skips the conflict check, uploads every file at HEAD (no deletes), leaves the sync baseline with the backend it belongs to, and requires --force. Without --force it stops with "pushing to a different backend than cloned from; use --force to copy". A push to the backend that was cloned from, or from a config that has no recorded host, keeps the existing baseline and conflict behavior.
This was referenced Sep 23, 2026
| const cliPath = path.resolve(__rootdir, 'src', 'cli.js').split(path.sep).join('/'); | ||
| const script = `import('file://${cliPath}').then(() => {` | ||
| + ' process.stdout.write(String(process.env.AEM_DA_ADMIN)); });'; | ||
| return shell.exec(`node -e ${JSON.stringify(script)}`, { |
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.
Closes #2795.
What
The
aem contentcommands were pinned toadmin.da.liveand a single hardcoded IMS provider. This resolves the da.live admin host and the IMS origin/client/scope from environment variables, defaulting to today's production values. With nothing set, behavior is unchanged.Changes
src/content/da-api.js- resolve the DA admin host fromAEM_DA_ADMIN(defaulthttps://admin.da.live); all/sourceand/listURLs use it.src/content/da-auth.js- resolve the IMS origin, client id, and scope fromAEM_DA_IMS_ORIGIN/AEM_DA_IMS_CLIENT_ID/AEM_DA_IMS_SCOPE(prod defaults). Cache the token per backend by keying the token file on the resolved host;admin.da.livekeeps its existing.hlx/.da-token.json, so nothing migrates.src/cli.js- load a local.envviadotenvbefore yargs parses, so its existing.env('AEM_')picks the vars up. A real shell variable overrides the file..envis gitignored.src/content/clone.cmd.js/push.cmd.js-clonerecords the source backend host; apushto a different backend than the clone source skips the source-baseline conflict check and requires--force, copying all files. Same-backend push is unchanged.Tests
New coverage for the env-resolved host and IMS config, the per-env token file, and the cross-backend copy path under
test/content/. Content tests and lint pass; the existing server suite is unaffected.These are advanced options and stay out of
--help; production remains the default everywhere.