lib/index.js
function setupConfig(options) {
    if (options.resetConfig) {
        // Reset your environment variables for resetting node-config module. node-config is a singleton.
        // For testing it's necessary to reset and this is a workaround from node-config support.
        global.NODE_CONFIG = null;
        delete require.cache[require.resolve('config')];
        config = require('config');
        delete options.resetConfig;
    }

    var customConfigFile, customConfig,
        defaultConfig       = require('../config/default.js');

    options = options || {};

    if (options.config) {
        customConfigFile    = options.config.charAt(0) === '/' || options.config.charAt(0) === '\\' ? options.config : path.join(process.cwd(), options.config); // Absolute or relative
        customConfig        = require(customConfigFile);
    }

    delete options.config;

    // Combine configs and override lower priority configs.
    config.util.extendDeep(config, defaultConfig, customConfig || {}, { "sequelize-pg-generator": options });
}
function setupConfig(options) {
    if (options.resetConfig) {
        // Reset your environment variables for resetting node-config module. node-config is a singleton.
        // For testing it's necessary to reset and this is a workaround from node-config support.
        global.NODE_CONFIG = null;
        delete require.cache[require.resolve('config')];
        config = require('config');
        delete options.resetConfig;
    }

    var customConfigFile, customConfig,
        defaultConfig       = require('../config/default.js');

    options = options || {};

    if (options.config) {
        customConfigFile    = options.config.charAt(0) === '/' || options.config.charAt(0) === '\\' ? options.config : path.join(process.cwd(), options.config); // Absolute or relative
        customConfig        = require(customConfigFile);
    }

    delete options.config;

    // Combine configs and override lower priority configs.
    config.util.extendDeep(config, defaultConfig, customConfig || {}, { "sequelize-pg-generator": options });
}
function setupConfig ( options ) { if ( options . resetConfig ) { // Reset your environment variables for resetting node-config module. node-config is a singleton. // For testing it's necessary to reset and this is a workaround from node-config support. global . NODE_CONFIG = null ; delete require . cache [ require . resolve ( 'config' ) ] ; config = require ( 'config' ) ; delete options . resetConfig ; } var customConfigFile , customConfig , defaultConfig = require ( '../config/default.js' ) ; options = options || { } ; if ( options . config ) { customConfigFile = options . config . charAt ( 0 ) === '/' || options . config . charAt ( 0 ) === '\\' ? options . config : path . join ( process . cwd ( ) , options . config ) ; // Absolute or relative customConfig = require ( customConfigFile ) ; } delete options . config ; // Combine configs and override lower priority configs. config . util . extendDeep ( config , defaultConfig , customConfig || { } , { "sequelize-pg-generator" : options } ) ; }
Combines default configuration, custom config file and command line options by overriding lower priority ones.
@private
@param {object} options - Options converted to config structure.
Combines default configuration custom config file and command line options by overriding lower priority ones .