"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const log_1 = require("./services/log"); const sessions_1 = require("./services/sessions"); const app = require("./app"); const version = 'v' + require('../package.json').version; const serverPort = Number(process.env.PORT) || 8191; const serverHost = process.env.HOST || '0.0.0.0'; function validateEnvironmentVariables() { if (process.env.LOG_LEVEL && ['error', 'warn', 'info', 'verbose', 'debug'].indexOf(process.env.LOG_LEVEL) == -1) { log_1.default.error(`The environment variable 'LOG_LEVEL' is wrong. Check the documentation.`); process.exit(1); } if (process.env.LOG_HTML && ['true', 'false'].indexOf(process.env.LOG_HTML) == -1) { log_1.default.error(`The environment variable 'LOG_HTML' is wrong. Check the documentation.`); process.exit(1); } if (process.env.HEADLESS && ['true', 'false'].indexOf(process.env.HEADLESS) == -1) { log_1.default.error(`The environment variable 'HEADLESS' is wrong. Check the documentation.`); process.exit(1); } } log_1.default.info(`FlareSolverr ${version}`); log_1.default.debug('Debug log enabled'); process.on('SIGTERM', () => { log_1.default.info("Process interrupted"); process.exit(0); }); process.on('uncaughtException', function (err) { log_1.default.error(err); }); validateEnvironmentVariables(); (0, sessions_1.testWebBrowserInstallation)().then(() => { app.listen(serverPort, serverHost, () => { log_1.default.info(`Listening on http://${serverHost}:${serverPort}`); }); }).catch(function (e) { log_1.default.error(e); const msg = "" + e; if (msg.includes('while trying to connect to the browser!')) { log_1.default.error(`It seems that the system is too slow to run FlareSolverr. If you are running with Docker, try to remove CPU limits in the container. If not, try setting the 'BROWSER_TIMEOUT' environment variable and the 'maxTimeout' parameter to higher values.`); } process.exit(1); }); //# sourceMappingURL=server.js.map