<commit_before>/*
 Copyright 2015 <NAME>

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

'use strict';

let config = {};

try {
  config = require('../../../../config/appConfig').config; // eslint-disable-line import/no-unresolved, global-require, import/no-dynamic-require
} catch (err) {
  console.log('Did not find modified appConfig. Using defaults');
}

/**
 * Converts string to boolean
 * @param {string} envar - Value
 * @returns {boolean} Converted boolean
 */
function convertToBoolean(envar) {
  if (envar === 'true') {
    return true;
  } else if (envar === 'false') {
    return false;
  }

  return undefined;
}

/*
 * All app specific configuration
 */

const userVerifyEnv = convertToBoolean(process.env.REQUIREVERIFY);
const revealFailedHackEnv = convertToBoolean(process.env.REVEALFAILEDHACK);
const forceFullscreenEnv = convertToBoolean(process.env.FORCEFULLSCREEN);
const gpsTrackingEnv = convertToBoolean(process.env.GPSTRACKING);
const teamVerifyEnv = convertToBoolean(process.env.REQUIRETEAMVERIFY);
const disableCommandsEnv = convertToBoolean(process.env.DISABLECOMMANDS);
const hideRoomNamesEnv = convertToBoolean(process.env.HIDEROOMNAMES);
const hideTimeStampEnv = convertToBoolean(process.env.HIDETIMESTAMP);
const staticInputStartEnv = convertToBoolean(process.env.STATICINPUTSTART);

// Title of the site
config.title = process.env.TITLE || config.title || 'roleHaven';

/**
 * Default language for clients connecting.
 * Default language is English.
 * Don't set this var if you want English to be the default language.
 * Valid options: se
 */
config.defaultLanguage = process.env.DEFAULTLANGUAGE || config.defaultLanguage || '';

/*
 * Base directory for public and private files
 */
config.publicBase = process.env.PUBLICBASE || config.publicBase || 'public';
config.privateBase = process.env.PRIVATEBASE || config.privateBase || 'private';

/*
 * Sub directories for public and private files
 * Will be appended to the base directories
 */
config.viewsPath = process.env.VIEWSPATH || config.viewsPath || 'views';
config.stylesPath = process.env.STYLESPATH || config.stylesPath || 'styles';
config.scriptsPath = process.env.SCRIPTSPATH || config.scriptsPath || 'scripts';
config.requiredPath = process.env.REQUIREDPATH || config.requiredPath || 'required';
config.faviconPath = process.env.FAVICONPATH || config.faviconPath || 'images/favicon.ico';

// Morgan log level
config.logLevel = process.env.LOGLEVEL || config.logLevel || 'tiny';

// Database host name
config.dbHost = process.env.DBHOST || config.dbHost || 'localhost';

// Database port
config.dbPort = process.env.DBPORT || config.dbPort || 27017;

// Database database name
config.dbName = process.env.DBNAME || config.dbName || 'roleHaven';

// Node server port number
config.port = process.env.PORT || config.port || 8888;

/*
 * Retrieve socket.io from local server or cdn
 * Note! Android 2.2 fails when using cdn
 */
config.socketPath = (process.env.SOCKETPATH === 'cdn' || config.socketPath === 'cdn') ?
  'https://cdn.socket.io/socket.io-1.4.5.js' : (process.env.SOCKETPATH || config.socketPath || '/scripts/socket.io-1.4.5.js');

/**
 * Server mode. Options:
 * prod, dev
 */
config.mode = process.env.MODE || config.mode || 'prod';


console.log(__dirname);
/**
 * Array of route paths
 * Should contain objects of site and file paths
 * sitePath : REQUESTPATH
 * filePath : ROUTEFILE
 *
 * Example:
 * {
 *   sitePath : '*',
 *   filePath : './routes/index.js'
 * }
 * @type {{sitePath:string, filePath:string}[]}
 */
config.routes = config.routes || [
  { sitePath: '/', filePath: '/usr/src/app/routes/index.js' },
  { sitePath: '/api/authenticate', filePath: '/usr/src/app/routes/rest/authenticate.js' },
  { sitePath: '/api/rooms', filePath: '/usr/src/app/routes/rest/rooms.js' },
  { sitePath: '/api/histories', filePath: '/usr/src/app/routes/rest/histories.js' },
  { sitePath: '/api/positions', filePath: '/usr/src/app/routes/rest/positions.js' },
  { sitePath: '/api/archives', filePath: '/usr/src/app/routes/rest/archives.js' },
  { sitePath: '/api/messages', filePath: '/usr/src/app/routes/rest/messages.js' },
  { sitePath: '/api/users', filePath: '/usr/src/app/routes/rest/users.js' },
  { sitePath: '*', filePath: '/usr/src/app/routes/error.js' },
];

//
// Instance specific
//

config.radioChannels = config.radioChannels || {};

config.gMapsKey = process.env.GMAPSKEY || config.gMapsKey;
config.mapLayersPath = process.env.MAPLAYERSPATH || config.mapLayersPath || 'https://www.google.com/maps/d/kml?hl=en_US&app=mp&mid=1j97gNHqYj-6M10RbW9CGAVNxUV4&forcekml=1&cid=mp&cv=jm93Tu_hxIY.en_US.';

config.country = process.env.COUNTRY || config.country || 'Sweden';
config.centerLat = parseFloat(process.env.CENTERLAT || config.centerLat || 59.3534372);
config.centerLong = parseFloat(process.env.CENTERLONG || config.centerLong || 18.0044666);
config.cornerOneLat = parseFloat(process.env.CORNERONELAT || config.cornerOneLat || 67.3926316);
config.cornerOneLong = parseFloat(process.env.CORNERONELONG || config.cornerOneLong || 24.0936037);<commit_msg>Corrected paths<commit_after>/*
 Copyright 2015 <NAME>

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

'use strict';

let config = {};

try {
  config = require('../../../../config/appConfig').config; // eslint-disable-line import/no-unresolved, global-require, import/no-dynamic-require
} catch (err) {
  console.log('Did not find modified appConfig. Using defaults');
}

/**
 * Converts string to boolean
 * @param {string} envar - Value
 * @returns {boolean} Converted boolean
 */
function convertToBoolean(envar) {
  if (envar === 'true') {
    return true;
  } else if (envar === 'false') {
    return false;
  }

  return undefined;
}

/*
 * All app specific configuration
 */

const userVerifyEnv = convertToBoolean(process.env.REQUIREVERIFY);
const revealFailedHackEnv = convertToBoolean(process.env.REVEALFAILEDHACK);
const forceFullscreenEnv = convertToBoolean(process.env.FORCEFULLSCREEN);
const gpsTrackingEnv = convertToBoolean(process.env.GPSTRACKING);
const teamVerifyEnv = convertToBoolean(process.env.REQUIRETEAMVERIFY);
const disableCommandsEnv = convertToBoolean(process.env.DISABLECOMMANDS);
const hideRoomNamesEnv = convertToBoolean(process.env.HIDEROOMNAMES);
const hideTimeStampEnv = convertToBoolean(process.env.HIDETIMESTAMP);
const staticInputStartEnv = convertToBoolean(process.env.STATICINPUTSTART);

// Title of the site
config.title = process.env.TITLE || config.title || 'roleHaven';

/**
 * Default language for clients connecting.
 * Default language is English.
 * Don't set this var if you want English to be the default language.
 * Valid options: se
 */
config.defaultLanguage = process.env.DEFAULTLANGUAGE || config.defaultLanguage || '';

/*
 * Base directory for public and private files
 */
config.publicBase = process.env.PUBLICBASE || config.publicBase || 'public';
config.privateBase = process.env.PRIVATEBASE || config.privateBase || 'private';

/*
 * Sub directories for public and private files
 * Will be appended to the base directories
 */
config.viewsPath = process.env.VIEWSPATH || config.viewsPath || 'views';
config.stylesPath = process.env.STYLESPATH || config.stylesPath || 'styles';
config.scriptsPath = process.env.SCRIPTSPATH || config.scriptsPath || 'scripts';
config.requiredPath = process.env.REQUIREDPATH || config.requiredPath || 'required';
config.faviconPath = process.env.FAVICONPATH || config.faviconPath || 'images/favicon.ico';

// Morgan log level
config.logLevel = process.env.LOGLEVEL || config.logLevel || 'tiny';

// Database host name
config.dbHost = process.env.DBHOST || config.dbHost || 'localhost';

// Database port
config.dbPort = process.env.DBPORT || config.dbPort || 27017;

// Database database name
config.dbName = process.env.DBNAME || config.dbName || 'roleHaven';

// Node server port number
config.port = process.env.PORT || config.port || 8888;

/*
 * Retrieve socket.io from local server or cdn
 * Note! Android 2.2 fails when using cdn
 */
config.socketPath = (process.env.SOCKETPATH === 'cdn' || config.socketPath === 'cdn') ?
  'https://cdn.socket.io/socket.io-1.4.5.js' : (process.env.SOCKETPATH || config.socketPath || '/scripts/socket.io-1.4.5.js');

/**
 * Server mode. Options:
 * prod, dev
 */
config.mode = process.env.MODE || config.mode || 'prod';


console.log(__dirname);
/**
 * Array of route paths
 * Should contain objects of site and file paths
 * sitePath : REQUESTPATH
 * filePath : ROUTEFILE
 *
 * Example:
 * {
 *   sitePath : '*',
 *   filePath : './routes/index.js'
 * }
 * @type {{sitePath:string, filePath:string}[]}
 */
config.routes = config.routes || [
  { sitePath: '/', filePath: '../../../../routes/index.js' },
  { sitePath: '/api/authenticate', filePath: '../../../../routes/rest/authenticate.js' },
  { sitePath: '/api/rooms', filePath: '../../../../routes/rest/rooms.js' },
  { sitePath: '/api/histories', filePath: '../../../../routes/rest/histories.js' },
  { sitePath: '/api/positions', filePath: '../../../../routes/rest/positions.js' },
  { sitePath: '/api/archives', filePath: '../../../../routes/rest/archives.js' },
  { sitePath: '/api/messages', filePath: '../../../../routes/rest/messages.js' },
  { sitePath: '/api/users', filePath: '../../../../routes/rest/users.js' },
  { sitePath: '*', filePath: '../../../../routes/error.js' },
];

//
// Instance specific
//

config.radioChannels = config.radioChannels || {};

config.gMapsKey = process.env.GMAPSKEY || config.gMapsKey;
config.mapLayersPath = process.env.MAPLAYERSPATH || config.mapLayersPath || 'https://www.google.com/maps/d/kml?hl=en_US&app=mp&mid=1j97gNHqYj-6M10RbW9CGAVNxUV4&forcekml=1&cid=mp&cv=jm93Tu_hxIY.en_US.';

config.country = process.env.COUNTRY || config.country || 'Sweden';
config.centerLat = parseFloat(process.env.CENTERLAT || config.centerLat || 59.3534372);
config.centerLong = parseFloat(process.env.CENTERLONG || config.centerLong || 18.0044666);
config.cornerOneLat = parseFloat(process.env.CORNERONELAT || config.cornerOneLat || 67.3926316);
config.cornerOneLong = parseFloat(process.env.CORNERONELONG || config.cornerOneLong || 24.0936037);
{'fraction_non_alphanumeric': 0.15308419630796938, 'fraction_numerical': 0.012967131922557407, 'mean_word_length': 4.273504273504273, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, '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': '3684447', 'n_tokens_mistral': 3597, 'n_tokens_neox': 3494, 'n_words': 806}