fix: move sub2api runtime to PK01 host docker
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user