<commit_before>var fs = require('fs')
var random = require('randomstring')
var path = require('path')

APP_ROOT_DIR = path.join(__dirname, '..')

APP_ROOT_REFRESH_MS = 30 * 60 * 1000
APP_COOKIE_SECRET = random.generate(16)
APP_DEPLOYMENT = process.env.DEPLOYMENT
APP_VERSION = require(path.join(APP_ROOT_DIR, 'package.json')).version
APP_DEBUG = process.env.DEBUG
APP_PORT = process.env.PORT || 3000
ENTU_POLL_SEC = process.env.ENTU_POLL_SEC * 1e3 || 10e3

APP_ENTU_OPTIONS = {
  entuUrl: process.env.ENTU_URL || 'https://saal.entu.ee',
  user: process.env.ENTU_USER,
  key: process.env.ENTU_KEY
}

// Site data cache
APP_ENTU_ROOT = 1 // institution
APP_CACHE_DIR = path.join(APP_ROOT_DIR, 'pagecache')
if (!fs.existsSync(APP_CACHE_DIR)) { fs.mkdirSync(APP_CACHE_DIR) }

if (!process.env.ENTU_USER) {
  throw '"ENTU_USER" missing in environment'
}
if (!process.env.ENTU_KEY) {
  throw '"ENTU_KEY" missing in environment'
}

console.log('\n\nEnv loaded for', APP_ROOT_DIR, APP_VERSION)<commit_msg>move pagecache out from project dir<commit_after>var fs = require('fs')
var random = require('randomstring')
var path = require('path')

APP_ROOT_DIR = path.join(__dirname, '..')

APP_ROOT_REFRESH_MS = 30 * 60 * 1000
APP_COOKIE_SECRET = random.generate(16)
APP_DEPLOYMENT = process.env.DEPLOYMENT
APP_VERSION = require(path.join(APP_ROOT_DIR, 'package.json')).version
APP_DEBUG = process.env.DEBUG
APP_PORT = process.env.PORT || 3000
ENTU_POLL_SEC = process.env.ENTU_POLL_SEC * 1e3 || 10e3

APP_ENTU_OPTIONS = {
  entuUrl: process.env.ENTU_URL || 'https://saal.entu.ee',
  user: process.env.ENTU_USER,
  key: process.env.ENTU_KEY
}

// Site data cache
APP_ENTU_ROOT = 1 // institution
APP_CACHE_DIR = path.join(APP_ROOT_DIR, '..', 'www_cache')
if (!fs.existsSync(APP_CACHE_DIR)) { fs.mkdirSync(APP_CACHE_DIR) }

if (!process.env.ENTU_USER) {
  throw '"ENTU_USER" missing in environment'
}
if (!process.env.ENTU_KEY) {
  throw '"ENTU_KEY" missing in environment'
}

console.log('\n\nEnv loaded for', APP_ROOT_DIR, APP_VERSION)
{'fraction_non_alphanumeric': 0.13996043521266074, 'fraction_numerical': 0.019782393669634024, 'mean_word_length': 5.341692789968652, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 1, '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': '63723', 'n_tokens_mistral': 817, 'n_tokens_neox': 775, 'n_words': 144}