fix: move sub2api runtime to PK01 host docker

This commit is contained in:
Codex
2026-06-28 14:24:08 +00:00
parent 1d07df3df1
commit d225fd1a61
18 changed files with 1088 additions and 186 deletions
+10 -1
View File
@@ -24,7 +24,7 @@ export function renderPk01Caddyfile(target: Sub2ApiTargetConfig, exposure: Sub2A
sub2apiCaddyManagedMarker(target),
renderSimpleReverseProxyCaddySiteBlock({
hostname: exposure.dns.hostname,
upstream: `127.0.0.1:${exposure.frpc.remotePort}`,
upstream: publicExposureUpstream(target, exposure),
responseHeaderTimeoutSeconds: exposure.pk01.responseHeaderTimeoutSeconds,
}),
);
@@ -43,6 +43,15 @@ ${apiBlock.trim()}
`;
}
export function publicExposureUpstream(target: Sub2ApiTargetConfig, exposure: Sub2ApiPublicExposureConfig): string {
if (exposure.mode === "pk01-local") {
if (exposure.local === null) throw new Error(`publicExposure.local is required for target ${target.id} when mode=pk01-local`);
return `${exposure.local.upstreamHost}:${exposure.local.upstreamPort}`;
}
if (exposure.frpc === null) throw new Error(`publicExposure.frpc is required for target ${target.id} when mode=frp`);
return `127.0.0.1:${exposure.frpc.remotePort}`;
}
export function renderPk01CaddyService(exposure: Sub2ApiPublicExposureConfig): string {
return `[Unit]
Description=UniDesk PK01 Caddy edge for PikaPython and Sub2API