<commit_before>"use strict";

const os = require('os');


const fs = require('fs');
const path = require('path');
const { initSecure } = require('./lib/secure');
const { initSidMap, removeUser } = require('./lib/session');
let isPro = process.env.NODE_ENV === 'production';

let homeDir = os.userInfo().homedir;
let tmpDir,
  clientVersion,
  confPath,
  conf;

if(isPro){
  tmpDir = os.tmpdir();
  clientVersion = _getClientVersion();
  confPath = path.join(homeDir, 'config.js');
}else {
  tmpDir = '/dev/shm'; // Protect my disk
  clientVersion = 'dev';
  confPath = path.join(__dirname, '../../server/config-dev.js');
}

if(!clientVersion){
  console.error('Not has clientVersion.');
  process.exit(1);
}
// linux-remote Prevent cookies across ports
global.__API_PATH__ = '/__LR_P_C_A_P__';
global.__HOME_DIR__ = homeDir;
global.IS_PRO = isPro;
global.__TMP_DIR__ = tmpDir;
global.__CLIENT_VERSION__ = clientVersion;
conf = global.CONF = require(confPath);

if(conf.appTrustProxy === true){
  console.error("can't set appTrustProxy true.");
  process.exit(1);
}

if(conf.secure){
  let errMsg = initSecure(conf.secure);<commit_msg>LRPCA<commit_after>"use strict";

const os = require('os');


const fs = require('fs');
const path = require('path');
const { initSecure } = require('./lib/secure');
const { initSidMap, removeUser } = require('./lib/session');
let isPro = process.env.NODE_ENV === 'production';

let homeDir = os.userInfo().homedir;
let tmpDir,
  clientVersion,
  confPath,
  conf;

if(isPro){
  tmpDir = os.tmpdir();
  clientVersion = _getClientVersion();
  confPath = path.join(homeDir, 'config.js');
}else {
  tmpDir = '/dev/shm'; // Protect my disk
  clientVersion = 'dev';
  confPath = path.join(__dirname, '../../server/config-dev.js');
}

if(!clientVersion){
  console.error('Not has clientVersion.');
  process.exit(1);
}
conf = global.CONF = require(confPath);
// linux-remote Prevent cookies across ports
global.__API_PATH__ = '/_LRPCA_' + conf.port;
global.__HOME_DIR__ = homeDir;
global.IS_PRO = isPro;
global.__TMP_DIR__ = tmpDir;
global.__CLIENT_VERSION__ = clientVersion;


if(conf.appTrustProxy === true){
  console.error("can't set appTrustProxy true.");
  process.exit(1);
}

if(conf.secure){
  let errMsg = initSecure(conf.secure);
{'fraction_non_alphanumeric': 0.1693121693121693, 'fraction_numerical': 0.001763668430335097, 'mean_word_length': 4.68671679197995, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5232034', 'n_tokens_mistral': 784, 'n_tokens_neox': 775, 'n_words': 166}