<commit_before>/**
 * Created by filip on 3/2/16.
 */
var ConfigFile = require('../../config/local.env');
var _ = require('lodash');

exports.getConfig = function (req, res) {
    return res.json(_.omit(ConfigFile, ['GITHUB_ID', 'GITHUB_SECRET', 'GITHUB_SCOPE']));
};
<commit_msg>filter config<commit_after>/**
 * Created by filip on 3/2/16.
 */
var ConfigFile = require('../../config/local.env');
var _ = require('lodash');

function filterConfig(conf) {
    var config = _.clone(conf, true);
    var forbidden = ['GITHUB*', 'SESSION_SECRET', 'GOOGLE*', 'TWITTER*',  'FACEBOOK*'];

    _.forEach(config, function (val, key) {

        // TODO: fix find not optimal
        var find = _.find(forbidden, function (v) {
            var pattern = new RegExp(v , 'ig');
            return pattern.test(key);
        });

        if (find) {
            config[key] = null;
            delete config[key];
        }
    });

    return config;
}

exports.getConfig = function (req, res) {
    return res.json(filterConfig(ConfigFile));
};

{'fraction_non_alphanumeric': 0.1760154738878143, 'fraction_numerical': 0.007736943907156673, 'mean_word_length': 2.7364620938628157, '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': '5435700', 'n_tokens_mistral': 354, 'n_tokens_neox': 339, 'n_words': 80}