fix(bs): server not right

This commit is contained in:
2026-04-29 16:27:23 +02:00
parent ab6a788b36
commit 2ce6fea782
2 changed files with 19 additions and 9 deletions

View File

@@ -23,10 +23,11 @@ MEDIAMTX_API_HQ=http://localhost:9997
NEXT_PUBLIC_MEDIAMTX_INGEST_ROUTE_HQ=localhost:8890
NEXT_PUBLIC_MEDIAMTX_WHIP_ROUTE_HQ=http://localhost:8889
# commented because we don't have another ingest server as of right now
# NEXT_PUBLIC_MEDIAMTX_URL_ASIA=http://localhost:8991
# MEDIAMTX_API_ASIA=http://localhost:9999
# NEXT_PUBLIC_MEDIAMTX_INGEST_ROUTE_ASIA=localhost:8990
# optional EU mirror
# NEXT_PUBLIC_MEDIAMTX_URL_ETHANDE=https://hls-eu.example.com
# MEDIAMTX_API_ETHANDE=https://mediamtx-api-eu.example.com
# NEXT_PUBLIC_MEDIAMTX_INGEST_ROUTE_ETHANDE=ingest-eu.example.com:8890
# NEXT_PUBLIC_MEDIAMTX_WHIP_ROUTE_ETHANDE=https://webrtc-eu.example.com
# generate with `openssl rand -base64 20`
MEDIAMTX_PUBLISH_KEY=

View File

@@ -5,11 +5,9 @@ export interface MediaMTXEnvs {
apiAuthHeader?: string;
}
export const MEDIAMTX_SERVER_REGIONS: Record<MediaMTXRegion, MediaMTXEnvs> = {
hq: {
apiUrl: process.env.MEDIAMTX_API_HQ!,
apiAuthHeader: getMediamtxApiAuthHeader(),
},
export const MEDIAMTX_SERVER_REGIONS: Partial<Record<MediaMTXRegion, MediaMTXEnvs>> = {
hq: createMediamtxEnvs(process.env.MEDIAMTX_API_HQ),
ethande: createMediamtxEnvs(process.env.MEDIAMTX_API_ETHANDE),
};
export function getMediamtxEnvs(region: MediaMTXRegion = 'hq'): MediaMTXEnvs {
@@ -31,3 +29,14 @@ function getMediamtxApiAuthHeader() {
return `Basic ${Buffer.from(`hctv-api:${apiKey}`).toString('base64')}`;
}
function createMediamtxEnvs(apiUrl?: string): MediaMTXEnvs | undefined {
if (!apiUrl) {
return undefined;
}
return {
apiUrl,
apiAuthHeader: getMediamtxApiAuthHeader(),
};
}