feat: add independent TLS control for relay public endpoint (#1045)
* feat: add independent TLS control for relay public endpoint Add PASEO_RELAY_PUBLIC_USE_TLS env var and publicUseTls persisted config to separately control TLS for the client→relay pairing offer, falling back to relayUseTls when unset. The daemon→relay connection continues to use PASEO_RELAY_USE_TLS alone. Enables self-hosting behind a TLS-terminating reverse proxy where the internal path is plain ws:// but public clients need wss://. * fix: use public relay TLS in daemon status --------- Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
This commit is contained in:
co-authored by
Mohamed Boudra
parent
ee44b536f5
commit
338a41991d
@@ -148,6 +148,18 @@ interface ResolvedRelay {
|
||||
endpoint: string;
|
||||
publicEndpoint: string;
|
||||
useTls: boolean;
|
||||
publicUseTls: boolean;
|
||||
}
|
||||
|
||||
function resolveTlsFromEnv(
|
||||
envValue: string | undefined,
|
||||
persistedValue: boolean | undefined,
|
||||
fallback: boolean,
|
||||
): boolean {
|
||||
if (envValue !== undefined) {
|
||||
return parseBooleanEnv(envValue) ?? false;
|
||||
}
|
||||
return persistedValue ?? fallback;
|
||||
}
|
||||
|
||||
function resolveRelayConfig(input: ResolveRelayInput): ResolvedRelay {
|
||||
@@ -166,10 +178,17 @@ function resolveRelayConfig(input: ResolveRelayInput): ResolvedRelay {
|
||||
endpoint;
|
||||
const useTls =
|
||||
input.cliRelayUseTls ??
|
||||
(input.env.PASEO_RELAY_USE_TLS !== undefined
|
||||
? (parseBooleanEnv(input.env.PASEO_RELAY_USE_TLS) ?? false)
|
||||
: (input.persisted.daemon?.relay?.useTls ?? endpoint === DEFAULT_RELAY_ENDPOINT));
|
||||
return { enabled, endpoint, publicEndpoint, useTls };
|
||||
resolveTlsFromEnv(
|
||||
input.env.PASEO_RELAY_USE_TLS,
|
||||
input.persisted.daemon?.relay?.useTls,
|
||||
endpoint === DEFAULT_RELAY_ENDPOINT,
|
||||
);
|
||||
const publicUseTls = resolveTlsFromEnv(
|
||||
input.env.PASEO_RELAY_PUBLIC_USE_TLS,
|
||||
input.persisted.daemon?.relay?.publicUseTls,
|
||||
useTls,
|
||||
);
|
||||
return { enabled, endpoint, publicEndpoint, useTls, publicUseTls };
|
||||
}
|
||||
|
||||
interface ResolvedVoiceLlm {
|
||||
@@ -305,6 +324,7 @@ export function loadConfig(
|
||||
relayEndpoint: relay.endpoint,
|
||||
relayPublicEndpoint: relay.publicEndpoint,
|
||||
relayUseTls: relay.useTls,
|
||||
relayPublicUseTls: relay.publicUseTls,
|
||||
appBaseUrl,
|
||||
auth: resolveAuthConfig(env, persisted),
|
||||
openai,
|
||||
|
||||
Reference in New Issue
Block a user