feat: add hwlab opencode public proxy config
This commit is contained in:
@@ -455,6 +455,7 @@ export function publicExposureSummary(exposure: HwlabRuntimePublicExposureSpec):
|
||||
tokenKey: exposure.tokenKey,
|
||||
webProxy: exposure.webProxy,
|
||||
apiProxy: exposure.apiProxy,
|
||||
extraProxies: exposure.extraProxies,
|
||||
},
|
||||
caddy: {
|
||||
route: exposure.caddyRoute,
|
||||
@@ -982,7 +983,7 @@ export function publicExposureCaddyScript(options: NodePublicExposureOptions, ex
|
||||
|
||||
export function publicExposureCaddyBlock(exposure: HwlabRuntimePublicExposureSpec): string {
|
||||
const tlsLines = exposure.caddyTls === "internal" ? " tls internal\n" : "";
|
||||
return `${exposure.hostname} {
|
||||
const mainBlock = `${exposure.hostname} {
|
||||
${tlsLines} @api path /health* /auth* /v1* /json-rpc* /openapi* /docs* /swagger*
|
||||
reverse_proxy @api 127.0.0.1:${exposure.apiProxy.remotePort} {
|
||||
transport http {
|
||||
@@ -995,6 +996,16 @@ ${tlsLines} @api path /health* /auth* /v1* /json-rpc* /openapi* /docs* /swagg
|
||||
}
|
||||
}
|
||||
}`;
|
||||
const extraBlocks = exposure.extraProxies
|
||||
.filter((proxy) => proxy.hostname !== undefined)
|
||||
.map((proxy) => `${proxy.hostname} {
|
||||
${tlsLines} reverse_proxy 127.0.0.1:${proxy.remotePort} {
|
||||
transport http {
|
||||
response_header_timeout ${exposure.responseHeaderTimeoutSeconds}s
|
||||
}
|
||||
}
|
||||
}`);
|
||||
return [mainBlock, ...extraBlocks].join("\n\n");
|
||||
}
|
||||
|
||||
export function runTransScript(node: string, script: string, input: string, timeoutSeconds: number): CommandResult {
|
||||
|
||||
Reference in New Issue
Block a user