Repository navigation
feat: write the app service token as SEAMLESS_SERVICE_TOKEN - #278
Merged
Merged
Conversation
Applications now read their service token as SEAMLESS_SERVICE_TOKEN, the name the managed portal uses. The auth server keeps API_SERVICE_TOKEN. - init: compose app services (api, or a full-stack web) get SEAMLESS_SERVICE_TOKEN with a comment tying it to the auth service's API_SERVICE_TOKEN; managed connect writes and prints the new name. - add: the backend .env and the printed Node, Go, Rust and Python code use the new name. - verify: the reference apps read SEAMLESS_SERVICE_TOKEN; the Next.js starter gets both names so pre-rename starters still run. A project whose .env already has API_SERVICE_TOKEN and not the new name has that variable updated in place, with a note, instead of gaining a second variable the app does not read.
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
Applications now read their service token as
SEAMLESS_SERVICE_TOKEN, the name the managed portal's snippet already uses. The auth server keeps readingAPI_SERVICE_TOKEN(the pinned auth API, v0.18.0, only knows that name).docker-compose.ymlgives theapiservice (or the full-stackwebservice)SEAMLESS_SERVICE_TOKEN. Theauthservice keepsAPI_SERVICE_TOKENwith the same value, and a comment above the app's variable says so.SEAMLESS_SERVICE_TOKENintoapi/.env; the values printed when there is noapi/use the new name and mention the old one for older backends..envgetsSEAMLESS_SERVICE_TOKEN, and the printed Node, Go, Rust and Python code reads it.SEAMLESS_SERVICE_TOKEN; the Next.js service is given both names so starters from before the rename still run.CONFORMANCE.mddocuments the new name. The harness's own inputs (API_SERVICE_TOKENon the host,SEAMLESS_API_SERVICE_TOKENfor Playwright) are the auth API's secret and are unchanged.add, README.Existing projects
When a project's
.envalready hasAPI_SERVICE_TOKENand notSEAMLESS_SERVICE_TOKEN,seamless addand managed connect updateAPI_SERVICE_TOKENin place, print a note saying so, and (foradd) print code that reads that name. They never add a second variable the app does not read.src/core/serviceToken.tsholds that rule.Every remaining
API_SERVICE_TOKENhit is deliberateThe auth server env (
buildAuthEnv,extractSharedFromExistingEnv, theseamless/stack fromadd --local), the verify harness inputs, the legacy-name branch and its tests, and the docs that explain the two names.Merge and release order
This PR goes first. It pairs with fells-code/seamless-templates#122 (the starters rename,
requires.cliMin0.24.0).v0.19.1, whose starters readAPI_SERVICE_TOKENfrom theapi/.envwritten from theirtemplate.json, and managed connect andaddkeep that name for such a project. It also has to land before the templates PR, because the templates PR's conformance run uses this repo'smainverify stack, and only this PR gives the Next.js serviceSEAMLESS_SERVICE_TOKEN.SEAMLESS_TEMPLATES_REF/SEAMLESS_TEMPLATES_COMMITto that templates tag.Verification
npm run build: passes.npm test: 64 files passed, 1 skipped; 1333 tests passed, 4 skipped.npm run check:types-current,npm run check:templates-pin: pass.SEAMLESS_TEMPLATES_DIRat the templates branch:init my-app --local --yes --email=you@example.com </dev/nullsucceeds;api/.envhasSEAMLESS_SERVICE_TOKEN;docker compose configshowsapi: SEAMLESS_SERVICE_TOKENandauth: API_SERVICE_TOKENwith the same value;npm run checkin the scaffoldedapi/passes (22 tests) and itsassertEnvironment()passes on the generated.env. Without the 0.24.0 version the templates branch refuses with "requires seamless-cli >= 0.24.0".v0.19.1: the starter'sapi/.envAPI_SERVICE_TOKENequals the composeSEAMLESS_SERVICE_TOKEN, so step 1 is safe.add --local --yes --skip-installon a scratch Express app: writesSEAMLESS_SERVICE_TOKEN(equal toseamless/.env'sAPI_SERVICE_TOKEN) and printsprocess.env.SEAMLESS_SERVICE_TOKEN. On one whose.envalready hadAPI_SERVICE_TOKEN: updates it in place, prints the note, adds no second variable, and printsprocess.env.API_SERVICE_TOKEN.scripts/scaffold-smoke.sh(ports 5432 and 5312 are held by another local stack). It coversdbandauth, which this does not change.