Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ where the principal is the C2C installation (`c2c_inst_…`).
To upgrade without deleting legacy files:

```bash
c2c broker migrate-auth
c2c broker migrate-auth — merges legacy per-workspace tokens into the installation store; restarts the broker when running so migrated tokens are recognized immediately.
```

This copies live client registrations and unexpired tokens into the
Expand Down
10 changes: 10 additions & 0 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1451,6 +1451,16 @@ brokerCmd
`Migrated ${result.tokensMigrated} token(s) from ${result.sourceFiles.length} legacy file(s) to ${result.installationId}`
);
say("Legacy auth files were kept for rollback.");
// The running broker holds auth in memory: restart so migrated tokens
// are recognized without waiting for the next natural restart.
const { stopBroker, ensureBroker } = await import("../broker/daemon.js");
const wasRunning = (await import("../broker/daemon.js")).installationRuntime();
if (wasRunning) {
await stopBroker();
await new Promise((resolve) => setTimeout(resolve, 500));
await ensureBroker();
check("Broker restarted to load the migrated tokens");
}
} catch (error) {
handleCliError(error, opts.json);
}
Expand Down
Loading