<commit_before>"use strict";

//https://github.com/flatiron/nconf
var nconf = require("nconf"),
    path = require("path"),
    _ = require("underscore");

var defaultConfig = require(__dirname + "/" + "config.json");

/**
 * Hierarchical load config from 1. ARGV, 2. ENV, 3. CWD/config.json or 4. default config
 * If you pass --config via ARGV or ENV, this file will be loaded as config.json instead of the default
 *
 * **Examples:**
 * alamid --port 1234 : load default-config but overwrite port
 * alamid --config /your/path/to/config.json : load your own config json
 * alamid --config /your/path/to/config.json --port 1234 : load your own config.json but overwrite the port
 *
 * @return {Object} config
 */
module.exports = function readConfig() {

    var conf = {};
    var configPath;

    //parse args & env first
    nconf.argv()
         .env();

    //load default config file if none is set
    if(nconf.get("config") === undefined){
        configPath = path.normalize(process.cwd() + "/" + "config.json");
        console.log("Trying to read from CWD: " + configPath);
    }
    //check if path to custom config was passed and load if set
    else{<commit_msg>reformatting<commit_after>"use strict";

//https://github.com/flatiron/nconf
var nconf = require("nconf"),
    path = require("path"),
    _ = require("underscore");

var defaultConfig = require(__dirname + "/" + "config.json");

/**
 * Hierarchical load config from 1. ARGV, 2. ENV, 3. CWD/config.json or 4. default config
 * If you pass --config via ARGV or ENV, this file will be loaded as config.json instead of the default
 *
 * **Examples:**
 * alamid --port 1234 : load default-config but overwrite port
 * alamid --config /your/path/to/config.json : load your own config json
 * alamid --config /your/path/to/config.json --port 1234 : load your own config.json but overwrite the port
 *
 * @return {Object} config
 */
module.exports = function readConfig() {

    var conf = {};
    var configPath;

    //parse args & env first
    nconf.argv()
         .env();

    //load default config file if none is set
    if (nconf.get("config") === undefined) {
        configPath = path.normalize(process.cwd() + "/" + "config.json");
        console.log("Trying to read from CWD: " + configPath);
    }
    //check if path to custom config was passed and load if set
    else {
{'fraction_non_alphanumeric': 0.13740458015267176, 'fraction_numerical': 0.010178117048346057, 'mean_word_length': 2.9316666666666666, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '3705370', 'n_tokens_mistral': 750, 'n_tokens_neox': 705, 'n_words': 248}