Loading backend/src/constants/server.contants.ts +14 −1 Original line number Diff line number Diff line import * as dotenv from 'dotenv'; dotenv.config(); import * as os from 'os'; let ip = ''; const interfaces = os.networkInterfaces(); for (const interfaceName in interfaces) { const networkInterfaces = interfaces[interfaceName]; for (const networkInterface of networkInterfaces) { if (networkInterface.family === 'IPv4' && !networkInterface.internal) { ip = networkInterface.address; } } } export class ServerConstants { static PORT: number = process.env.SERVER_PORT ? parseInt(process.env.SERVER_PORT) : 3003; static HOST: string = `${process.env.SERVER_HOST || 'http://localhost'}:${this.PORT}`; static IP: string = ip; static HOST: string = `${ip || 'http://localhost'}:${this.PORT}`; } Loading
backend/src/constants/server.contants.ts +14 −1 Original line number Diff line number Diff line import * as dotenv from 'dotenv'; dotenv.config(); import * as os from 'os'; let ip = ''; const interfaces = os.networkInterfaces(); for (const interfaceName in interfaces) { const networkInterfaces = interfaces[interfaceName]; for (const networkInterface of networkInterfaces) { if (networkInterface.family === 'IPv4' && !networkInterface.internal) { ip = networkInterface.address; } } } export class ServerConstants { static PORT: number = process.env.SERVER_PORT ? parseInt(process.env.SERVER_PORT) : 3003; static HOST: string = `${process.env.SERVER_HOST || 'http://localhost'}:${this.PORT}`; static IP: string = ip; static HOST: string = `${ip || 'http://localhost'}:${this.PORT}`; }