<commit_before>'use strict';

const convict = require('convict');
const bluebird = require('bluebird');
const access = bluebird.promisify(require('fs').access);
const path = require('path');
const localConfig = path.resolve(__dirname, '..', 'config', 'local.json');

const fileExists = (fPath) => {
  return access(fPath).then(() => true, () => false);
};

const conf = convict({
  env: {
    doc: 'The applicaton environment.',
    format: ['production', 'development'],
    default: 'production',
    env: 'NODE_ENV',
  },
  api: {
    hostname: 'coins-api.mrn.org',
    pathname: '/api/v1.3.0',
    protocol: 'https:',
  },
  db: {
    remote: {
      db: {
        hostname: 'coinstac.mrn.org',
        pathname: '',
        port: '',
        protocol: 'https:',
      },
    },
    noURLPrefix: true,
  },
  logFile: 'coinstac-log.json',
  // these are appended to the home dir for you OS
  // *nix: ~/.config/coinstac
  // win: C:\Users\username\AppData\Local\Temp\coinstac
  logLocations: {
    darwin: 'Library/Logs/coinstac/',
    freebsd: '.config/coinstac/',
    linux: '.config/coinstac/',
    sunos: '.config/coinstac/',
    win32: 'coinstac/',
  },
});

module.exports = function loadConfig() {
  // if (conf.get('env') === 'production') {
  //   return Promise.resolve(conf);
  // }

  return fileExists(localConfig)
  .then(exists => {
    if (exists) {
      conf.loadFile(localConfig);
    }
    return conf;
  });
};<commit_msg>actually dont screw up config<commit_after>'use strict';

const convict = require('convict');
const bluebird = require('bluebird');
const access = bluebird.promisify(require('fs').access);
const path = require('path');
const localConfig = path.resolve(__dirname, '..', 'config', 'local.json');

const fileExists = (fPath) => {
  return access(fPath).then(() => true, () => false);
};

const conf = convict({
  env: {
    doc: 'The applicaton environment.',
    format: ['production', 'development'],
    default: 'production',
    env: 'NODE_ENV',
  },
  api: {
    hostname: 'coins-api.mrn.org',
    pathname: '/api/v1.3.0',
    protocol: 'https:',
  },
  db: {
    remote: {
      db: {
        hostname: 'coinstac.mrn.org',
        pathname: '',
        port: '',
        protocol: 'https:',
      },
    },
    noURLPrefix: true,
  },
  logFile: 'coinstac-log.json',
  // these are appended to the home dir for you OS
  // *nix: ~/.config/coinstac
  // win: C:\Users\username\AppData\Local\Temp\coinstac
  logLocations: {
    darwin: 'Library/Logs/coinstac/',
    freebsd: '.config/coinstac/',
    linux: '.config/coinstac/',
    sunos: '.config/coinstac/',
    win32: 'coinstac/',
  },
});

module.exports = function loadConfig() {
  if (conf.get('env') === 'production') {
    return Promise.resolve(conf);
  }

  return fileExists(localConfig)
  .then(exists => {
    if (exists) {
      conf.loadFile(localConfig);
    }
    return conf;
  });
};
{'fraction_non_alphanumeric': 0.18821096173733196, 'fraction_numerical': 0.003447087211306446, 'mean_word_length': 2.9216216216216218, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '2536402', 'n_tokens_mistral': 1020, 'n_tokens_neox': 998, 'n_words': 208}