Commit 4e4f9955 authored by Diego Iván's avatar Diego Iván
Browse files

agrengado constantes de paths

parent d78d00eb
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
import * as dotenv from 'dotenv';
import * as network from 'network';
import { join } from 'path';

let publicIp: string;

@@ -8,11 +9,13 @@ dotenv.config();
export class ServerConstants {
  static PORT: number = process.env.SERVER_PORT ? parseInt(process.env.SERVER_PORT) : 3003;
  static IP: string = publicIp || 'http://localhost';
  static HOST: string = `${publicIp || 'http://localhost'}:${this.PORT}`;
  static HOST: string = `http://${publicIp || 'localhost'}:${this.PORT}`;
  static ROOT_PATH: string = join(__dirname, '..', '..');
  static ROOT_STATIC_PATH: string = join(__dirname, '..', '..', 'static');
}

network.get_private_ip(function (err, ip) {
  publicIp = ip;
  ServerConstants.IP = publicIp;
  ServerConstants.HOST = `${publicIp}:${ServerConstants.PORT}`;
  ServerConstants.HOST = `http://${publicIp || 'localhost'}:${ServerConstants.PORT}`;
});