common.js 4.05 KB
/**
 * 系统配置
 *
 * @author hbomb qiqi.zhou@yoho.cn
 * @date 2016/05/06
 */


const isProduction = process.env.NODE_ENV === 'production';
const isTest = process.env.NODE_ENV === 'test';

module.exports = {
    app: 'web',
    appVersion: '4.6.0', // 调用api的版本
    port: 6002,
    siteUrl: 'http://www.yohobuy.com',
    domains: {
        favApi: 'http://192.168.102.31:8092/brower',
        api: 'http://devapi.yoho.cn:58078/',
        service: 'http://devservice.yoho.cn:58077/',
        search: 'http://192.168.102.216:8080/yohosearch/'
    },
    subDomains: {
        host: 'www.yohobuy.com',
        default: '//www.yohobuy.com',
        guang: '//guang.yohobuy.com',
        list: '//list.yohobuy.com',
        search: '//search.yohobuy.com',
        huodong: '//huodong.yohobuy.com',
        activity: '//activity.yohobuy.com',
        index: '//www.yohobuy.com'
    },
    useOneapm: false,
    useCache: false,
    memcache: {
        master: ['192.168.102.222:11213'],
        slave: ['192.168.102.222:11213'],
        session: ['192.168.102.222:11213'],
        timeout: 1000,
        retries: 0
    },
    interfaceShunt: {
        useInterfaceShunt: false,
        tencentServers: {
            api: ['123.206.1.98', '123.206.2.80'],
            service: ['123.206.1.98', '123.206.2.80']
        },
        awsServers: {
            api: 'app-java-168863769.cn-north-1.elb.amazonaws.com.cn',
            service: 'service-yoho-579825100.cn-north-1.elb.amazonaws.com.cn'
        }
    },
    loggers: {
        infoFile: {
            name: 'info',
            level: 'info',
            filename: 'logs/info.log',
            maxFiles: 7
        },
        errorFile: {
            name: 'error',
            level: 'error',
            filename: 'logs/error.log',
            handleExceptions: true
        },
        udp: { // send by udp
            measurement: 'yohobuy_node_log',
            level: 'debug', // logger level
            host: 'influxdblog.yohoops.org', // influxdb host
            port: '4444' // influxdb port
        },
        console: {
            level: 'debug',
            colorize: 'all',
            prettyPrint: true
        }
    },
    thirdLogin: {
        wechat: {
            appID: 'wx3ae21dcbb82ad672',
            appSecret: 'e78afb2321e6a19085767e1a0f0d52c1'
        }
    }
};

if (isProduction) {
    Object.assign(module.exports, {
        appName: 'www.yohobuy.com',
        domains: {
            api: 'http://api.yoho.yohoops.org/',
            service: 'http://service.yoho.yohoops.org/',
            search: 'http://search.yohoops.org/yohosearch/'
        },
        memcache: {
            master: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'],
            slave: ['memcache1.yohoops.org:12112', 'memcache2.yohoops.org:12112', 'memcache3.yohoops.org:12112'],
            session: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'],
            timeout: 3000
        },
        useOneapm: true,
        useCache: true,
        interfaceShunt: {
            useInterfaceShunt: false,
            tencentServers: {
                api: ['123.206.1.98', '123.206.2.80'],
                service: ['123.206.1.98', '123.206.2.80']
            },
            awsServers: {
                api: 'app-java-168863769.cn-north-1.elb.amazonaws.com.cn',
                service: 'service-yoho-579825100.cn-north-1.elb.amazonaws.com.cn'
            }
        }
    });
} else if (isTest) {
    Object.assign(module.exports, {
        appName: 'www.yohobuy.com for test',
        domains: {
            favApi: 'http://192.168.102.31:8092/brower',
            api: 'http://testapi.yoho.cn:28078/',
            service: 'http://testservice.yoho.cn:28077/',
            search: 'http://192.168.102.216:8080/yohosearch/'
        },
        useOneapm: true,
        useCache: true,
        memcache: {
            master: ['127.0.0.1:12111'],
            slave: ['127.0.0.1:12112'],
            session: ['127.0.0.1:12111'],
            timeout: 1000,
            retries: 0
        }
    });
}