feat(dev): reuse pairing across ports and worktrees #8593
Closedt3dotgg(GitHub profile, opens in a new tab)wants to merge 1 commit into
main fromt3code/persistent-tailscale-pairingopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- @@ -414,0 +413,21 @@413+ port: Option.none(),414+ host: Option.none(),415+ baseDir: flags.baseDir,416+ cwd: Option.none(),417+ devUrl: flags.devUrl ?? Option.none(),418+ noBrowser: Option.none(),419+ bootstrapFd: Option.none(),420+ autoBootstrapProjectFromCwd: Option.none(),421+ logWebSocketEvents: Option.none(),422+ tailscaleServeEnabled: Option.none(),423+ tailscaleServePort: Option.none(),424+ },425+ cliLogLevel,426+ );427+ const runtimeState = yield* readPersistedServerRuntimeState(config.serverRuntimeStatePath);428+ if (Option.isNone(runtimeState)) {429+ return config;430+ }431+432+ const { devAuthDir: _ambientDevAuthDir, ...configWithoutDevAuthDir } = config;433+ const targetDevUrl = runtimeState.value.devUrl ? new URL(runtimeState.value.devUrl) : undefined;
- @@ -0,0 +75,21 @@75+ "db.name": DATABASE_NAME,76+ "service.name": "t3-dev-auth",77+ },78+ });79+ const sqlContext = yield* Layer.build(sqlLayer);80+ const storage = yield* Effect.gen(function* () {81+ const sql = yield* SqlClient.SqlClient;82+ yield* setupSchema();83+84+ const candidate = Encoding.encodeBase64Url(yield* crypto.randomBytes(32));85+ yield* sql`86+ INSERT INTO dev_auth_metadata (name, value)87+ VALUES (${SIGNING_SECRET_NAME}, ${candidate})88+ ON CONFLICT(name) DO NOTHING89+ `;90+ const rows = yield* sql<{ readonly value: unknown }>`91+ SELECT value AS "value"92+ FROM dev_auth_metadata93+ WHERE name = ${SIGNING_SECRET_NAME}94+ `;95+ const decodedRows = yield* decodeSigningSecretRows(rows);
- @@ -340,3 +346,10 @@340346 delete output.T3CODE_HOME;341347 }342348349+ if (isDesktopMode || isolatedAuth === true) {350+ delete output.T3CODE_DEV_AUTH_DIR;351+ } else {352+ const configuredDevAuthDir = baseEnv.T3CODE_DEV_AUTH_DIR?.trim();353+ output.T3CODE_DEV_AUTH_DIR = configuredDevAuthDir354+ ? path.resolve(configuredDevAuthDir)355+ : yield* DEFAULT_DEV_AUTH_DIR;
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.


Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
fdf747c6-d827-4f44-82f4-bb4d9edafde2You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Comment `@coderabbitai help` to get the list of available commands.