<commit_before>/* eslint consistent-return:0 */

const express = require('express');
const logger = require('./logger');

const argv = require('minimist')(process.argv.slice(2));
const setup = require('./middlewares/frontendMiddleware');
const isDev = process.env.NODE_ENV !== 'production';
const ngrok = (isDev && process.env.ENABLE_TUNNEL) || argv.tunnel ? require('ngrok') : false;
const resolve = require('path').resolve;
const proxy = require('http-proxy-middleware');
const app = express();
const appInfluxdb = express();

let controllerBackend = '192.168.99.100:31313';
if (process.env.FISSION_CONTROLLER !== undefined) {
  controllerBackend = process.env.FISSION_CONTROLLER;
}

let routerBackend = '192.168.99.100:31314';
if (process.env.FISSION_ROUTER !== undefined) {
  routerBackend = process.env.FISSION_ROUTER;
}

let k8sBackend = '127.0.0.1:28001';
if (process.env.FISSION_K8S !== undefined) {
  k8sBackend = process.env.FISSION_K8S;
}

let influxdbBackend = '192.168.99.100:31315';
if (process.env.FISSION_LOGDB !== undefined) {
  influxdbBackend = process.env.FISSION_LOGDB;
}

// Setup proxy for fission APIs
app.use('/proxy/controller', proxy({ target: `http://${controllerBackend}`, pathRewrite: { '^/proxy/controller': '' } }));
app.use('/proxy/router', proxy({ target: `http://${routerBackend}`, pathRewrite: { '^/proxy/router': '' } }));
app.use('/proxy/tpr/benchmark', proxy({ target: `http://${k8sBackend}`,
  pathRewrite: { '^/proxy/tpr/benchmark': '/apis/benchmark.fission.io/v1/namespaces/fission-benchmark' } }));
appInfluxdb.use('', proxy({ target: `http://${influxdbBackend}` }));

// In production we need to pass these values in instead of relying on webpack
setup(app, {
  outputPath: resolve(process.cwd(), 'build'),<commit_msg>Configure proxy to change origin<commit_after>/* eslint consistent-return:0 */

const express = require('express');
const logger = require('./logger');

const argv = require('minimist')(process.argv.slice(2));
const setup = require('./middlewares/frontendMiddleware');
const isDev = process.env.NODE_ENV !== 'production';
const ngrok = (isDev && process.env.ENABLE_TUNNEL) || argv.tunnel ? require('ngrok') : false;
const resolve = require('path').resolve;
const proxy = require('http-proxy-middleware');
const app = express();
const appInfluxdb = express();

let controllerBackend = '192.168.99.100:31313';
if (process.env.FISSION_CONTROLLER !== undefined) {
  controllerBackend = process.env.FISSION_CONTROLLER;
}

let routerBackend = '192.168.99.100:31314';
if (process.env.FISSION_ROUTER !== undefined) {
  routerBackend = process.env.FISSION_ROUTER;
}

let k8sBackend = '127.0.0.1:28001';
if (process.env.FISSION_K8S !== undefined) {
  k8sBackend = process.env.FISSION_K8S;
}

let influxdbBackend = '192.168.99.100:31315';
if (process.env.FISSION_LOGDB !== undefined) {
  influxdbBackend = process.env.FISSION_LOGDB;
}

// Setup proxy for fission APIs
app.use('/proxy/controller', proxy({ target: `http://${controllerBackend}`, pathRewrite: { '^/proxy/controller': '' }, changeOrigin: true }));
app.use('/proxy/router', proxy({ target: `http://${routerBackend}`, pathRewrite: { '^/proxy/router': '' }, changeOrigin: true }));
app.use('/proxy/tpr/benchmark', proxy({ target: `http://${k8sBackend}`,
  pathRewrite: { '^/proxy/tpr/benchmark': '/apis/benchmark.fission.io/v1/namespaces/fission-benchmark' }, changeOrigin: true }));
appInfluxdb.use('', proxy({ target: `http://${influxdbBackend}`, changeOrigin: true }));

// In production we need to pass these values in instead of relying on webpack
setup(app, {
  outputPath: resolve(process.cwd(), 'build'),
{'fraction_non_alphanumeric': 0.18216947281258625, 'fraction_numerical': 0.03698592326800994, 'mean_word_length': 5.52972972972973, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 8, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1149814', 'n_tokens_mistral': 1283, 'n_tokens_neox': 1237, 'n_words': 243}