UNPKG

rex-server

Version:

Rex Server is a Node.js-based reverse proxy server available as an npm package. It allows you to handle HTTP and HTTPS traffic, route requests to upstream servers, and manage worker processes efficiently. With its CLI interface, Rex makes it easy to confi

19 lines (18 loc) 793 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const _lib_1 = require("../lib/index"); const fs_1 = require("fs"); const path_1 = __importDefault(require("path")); try { const confPath = path_1.default.resolve(__dirname, '../../dist', 'conf', 'conf.js'); fetch("https://api.ipify.org/").then(res => res.text()).then((ip) => { const conf = (0, fs_1.readFileSync)(confPath).toString().replace(/PROXY_IP\s*:\s*"([^"]*)"/, `PROXY_IP : "${ip}"`); (0, fs_1.writeFileSync)(confPath, conf); }); } catch (error) { _lib_1.logger.error("ERROR_WHILE_FETCHING_IP: " + (0, _lib_1.formatObjects)(error)); }