api/config: store tunnelPort in env
This commit is contained in:
parent
d48cc8fc07
commit
90d57ab6ea
2 changed files with 4 additions and 4 deletions
|
@ -14,6 +14,7 @@ const enabledServices = new Set(Object.keys(services).filter(e => {
|
|||
const env = {
|
||||
apiURL: process.env.API_URL || '',
|
||||
apiPort: process.env.API_PORT || 9000,
|
||||
tunnelPort: process.env.API_PORT || 9000,
|
||||
|
||||
listenAddress: process.env.API_LISTEN_ADDRESS,
|
||||
freebindCIDR: process.platform === 'linux' && process.env.FREEBIND_CIDR,
|
||||
|
@ -56,8 +57,7 @@ const env = {
|
|||
const genericUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36";
|
||||
const cobaltUserAgent = `cobalt/${version} (+https://github.com/imputnet/cobalt)`;
|
||||
|
||||
export let tunnelPort = env.apiPort;
|
||||
export const setTunnelPort = (port) => tunnelPort = port;
|
||||
export const setTunnelPort = (port) => env.tunnelPort = port;
|
||||
export const isCluster = env.instanceCount > 1;
|
||||
|
||||
if (env.sessionEnabled && env.jwtSecret.length < 16) {
|
||||
|
|
|
@ -5,7 +5,7 @@ import { randomBytes } from "crypto";
|
|||
import { strict as assert } from "assert";
|
||||
import { setMaxListeners } from "node:events";
|
||||
|
||||
import { env, tunnelPort } from "../config.js";
|
||||
import { env } from "../config.js";
|
||||
import { closeRequest } from "./shared.js";
|
||||
import { decryptStream, encryptStream } from "../misc/crypto.js";
|
||||
import { hashHmac } from "../security/secrets.js";
|
||||
|
@ -102,7 +102,7 @@ export function createInternalStream(url, obj = {}) {
|
|||
isHLS: obj.isHLS,
|
||||
});
|
||||
|
||||
let streamLink = new URL('/itunnel', `http://127.0.0.1:${tunnelPort}`);
|
||||
let streamLink = new URL('/itunnel', `http://127.0.0.1:${env.tunnelPort}`);
|
||||
streamLink.searchParams.set('id', streamID);
|
||||
|
||||
const cleanup = () => {
|
||||
|
|
Loading…
Reference in a new issue