Files
paseo/packages/server/src/server/script-route-branch-handler.ts
T
Mohamed Boudra 4f3116d28a Unify workspace service URLs (#1288)
* Unify workspace service proxying

* Clean up service proxy review issues
2026-06-02 19:49:58 +08:00

25 lines
798 B
TypeScript

import type { Logger } from "pino";
import type { ServiceProxySubsystem } from "./service-proxy.js";
interface BranchChangeRouteHandlerOptions {
serviceProxy: ServiceProxySubsystem;
onRoutesChanged: (workspaceId: string) => void;
logger?: Logger;
}
export function createBranchChangeRouteHandler(
options: BranchChangeRouteHandlerOptions,
): (workspaceId: string, oldBranch: string | null, newBranch: string | null) => void {
return (workspaceId, _oldBranch, newBranch) => {
const changed = options.serviceProxy.replaceWorkspaceBranchRoutes({ workspaceId, newBranch });
if (!changed) {
return;
}
options.logger?.info(
{ workspaceId, newBranch },
"Updated service proxy routes for branch rename",
);
options.onRoutesChanged(workspaceId);
};
}