common.js 2.37 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 = {
    port: 6001,
    siteUrl: '//m.yohobuy.com',
    domains: {
        api: 'http://devapi.yoho.cn:58078/',
        service: 'http://devservice.yoho.cn:58077/',
        search: 'http://192.168.10.64:8080/yohosearch/'
    },
    useOneapm: false,
    useCache: false,
    memcache: {
        master: ['192.168.102.161:11213'],
        slave: ['192.168.102.161:11213'],
        session: ['192.168.102.161:11213'],
        timeout: 1000,
        retries: 0
    },
    loggers: {
        infoFile: {
            name: 'info',
            level: 'info',
            filename: 'logs/info.log'
        },
        errorFile: {
            name: 'error',
            level: 'error',
            filename: 'logs/error.log',
            handleExceptions: true
        },
        udp: { // send by udp
            level: 'debug', // logger level
            host: '192.168.102.162', // influxdb host
            port: '4444' // influxdb port
        },
        console: {
            level: 'debug',
            colorize: 'all',
            prettyPrint: true
        }
    },
    thirdLogin: {
        wechat: {
            appID: 'wx75e5a7c0c88e45c2',
            appSecret: 'ce21ae4a3f93852279175a167e54509b'
        }
    }
};

if (isProduction) {
    Object.assign(module.exports, {
        appName: 'm.yohobuy.com',
        domains: {
            api: 'http://api.yoho.yohoops.org/',
            service: 'http://service.yoho.yohoops.org/'
        },
        memcache: {
            master: ['172.31.22.1:12111', '172.31.20.56:12111', '172.31.31.146:12111'],
            slave: ['172.31.22.1:12112', '172.31.20.56:12112', '172.31.31.146:12112'],
            session: ['172.31.22.1:12111', '172.31.20.56:12111', '172.31.31.146:12111'],
            timeout: 3000
        },
        useOneapm: true,
        useCache: true
    });
} else if (isTest) {
    Object.assign(module.exports, {
        appName: 'm.yohobuy.com for test',
        memcache: {
            master: ['127.0.0.1:11212', '127.0.0.1:11213'],
            slave: ['127.0.0.1:11212', '127.0.0.1:11213'],
            session: ['127.0.0.1:11212', '127.0.0.1:11213'],
            timeout: 3000
        },
        useOneapm: true,
        useCache: true
    });
}