<commit_before>import MongoConnection from "./mongoConnection";
import Configuration from "./configuration";
import DevConfiguration from "./devConfiguration";
import TestConfiguration from "./testConfiguration";
import ProdConfiguration from "./prodConfiguration";
import {readFileSync} from "fs";

/**
 * @description Class used for get the necessary configuration.
 * @history
 * |      Author     | Action Performed |      Data      |
 * |       ---       |        ---       |       ---      |
 * | <NAME> | Create class     | 04/05/2016     |
 *
 * @author <NAME>
 * @license MIT
 */
class ChooseConfiguration {

    /**
     * @description Return the right configuration according to the Node.js
     * environment variable. It may be: 'development', 'test' or 'production'.
     * The default configuration is the 'production' one.
     * The connection's parameters are read fro an external json file named
     * mongoParameters.json.
     * @returns {Configuration} The configuration.
     */
    public static getConfig() : Configuration {
        /** @todo parameters */
        let params : MongoConnection = JSON.parse(readFileSync(
            "src/config/mongoParameters.json",
            "utf-8"
        ));
        let connection : MongoConnection = new MongoConnection(
            params["user"],
            params["password"],
            params["host"],
            params["port"],
            params["dbName"]
        );
        let serverSecret : string = "serverSecret";
        let config : Configuration;

        // Export the right configurations according to the NODE_ENV variable
        switch (process.env.NODE_ENV) {
            case "development":
                config = new DevConfiguration(connection, serverSecret);
                break;
            case "test":
                config = new TestConfiguration(connection, serverSecret);
                break;
            case "production":
                config = new ProdConfiguration(connection, serverSecret);
                break;
            default:
                config = new ProdConfiguration(connection, serverSecret);
                break;
        }
        return config;
    }
}

export default ChooseConfiguration;
<commit_msg>Remove @todo<commit_after>import MongoConnection from "./mongoConnection";
import Configuration from "./configuration";
import DevConfiguration from "./devConfiguration";
import TestConfiguration from "./testConfiguration";
import ProdConfiguration from "./prodConfiguration";
import {readFileSync} from "fs";

/**
 * @description Class used for get the necessary configuration.
 * @history
 * |      Author     | Action Performed |      Data      |
 * |       ---       |        ---       |       ---      |
 * | <NAME> | Create class     | 04/05/2016     |
 *
 * @author <NAME>
 * @license MIT
 */
class ChooseConfiguration {

    /**
     * @description Return the right configuration according to the Node.js
     * environment variable. It may be: 'development', 'test' or 'production'.
     * The default configuration is the 'production' one.
     * The connection's parameters are read fro an external json file named
     * mongoParameters.json.
     * @returns {Configuration} The configuration.
     */
    public static getConfig() : Configuration {
        let params : MongoConnection = JSON.parse(readFileSync(
            "src/config/mongoParameters.json",
            "utf-8"
        ));
        let connection : MongoConnection = new MongoConnection(
            params["user"],
            params["password"],
            params["host"],
            params["port"],
            params["dbName"]
        );
        let serverSecret : string = "serverSecret";
        let config : Configuration;

        // Export the right configurations according to the NODE_ENV variable
        switch (process.env.NODE_ENV) {
            case "development":
                config = new DevConfiguration(connection, serverSecret);
                break;
            case "test":
                config = new TestConfiguration(connection, serverSecret);
                break;
            case "production":
                config = new ProdConfiguration(connection, serverSecret);
                break;
            default:
                config = new ProdConfiguration(connection, serverSecret);
                break;
        }
        return config;
    }
}

export default ChooseConfiguration;

{'fraction_non_alphanumeric': 0.09562363238512035, 'fraction_numerical': 0.003938730853391685, 'mean_word_length': 1.9022222222222223, 'pattern_counts': {'":': 6, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6845088', 'n_tokens_mistral': 1094, 'n_tokens_neox': 1016, 'n_words': 319}