<commit_before>/* eslint-disable no-process-env */
'use strict';

const prefix = 'REST_ON_COUCH_';
const debug = require('../util/debug')('roc:env-config');

const envConfig = {};
for (const name in process.env) {
  if (name.startsWith(prefix)) {
    const realName = name
      .substring(prefix.length)
      .toLowerCase()
      .replace(/_([a-z])/g, function (value) {
        return value[1].toUpperCase();
      });
    debug('setting config from env, %s: %s', realName, process.env[name]);
    envConfig[realName] = process.env[name];
  }
}

module.exports = envConfig;<commit_msg>fix: convert "true" and "false" env values to booleans (#239)<commit_after>/* eslint-disable no-process-env */
'use strict';

const prefix = 'REST_ON_COUCH_';
const debug = require('../util/debug')('roc:env-config');

const envConfig = {};
for (const name in process.env) {
  if (name.startsWith(prefix)) {
    const realName = name
      .substring(prefix.length)
      .toLowerCase()
      .replace(/_([a-z])/g, function (value) {
        return value[1].toUpperCase();
      });

    let envValue = process.env[name];
    if (envValue === 'true') {
      envValue = true;
    } else if (envValue === 'false') {
      envValue = false;
    }

    debug('setting config from env, %s: %s', realName, envValue);
    envConfig[realName] = envValue;
  }
}

module.exports = envConfig;
{'fraction_non_alphanumeric': 0.17165814463111762, 'fraction_numerical': 0.003652300949598247, 'mean_word_length': 3.28125, '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': '2834711', 'n_tokens_mistral': 461, 'n_tokens_neox': 457, 'n_words': 106}