common.js 3.49 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: 'h5',
    port: 6001,
    siteUrl: '//m.yohobuy.com',
    assetUrl: '//localhost:5001',
    domains: {
        // api: 'http://devapi.yoho.cn:58078/',
        // service: 'http://devservice.yoho.cn:58077/'
        api: 'http://api.yoho.cn/',
        service: 'http://service.yoho.cn/',
        liveApi: 'http://testapi.live.yohops.com:9999/'
    },
    subDomains: {
        host: '.m.yohobuy.com',
        default: '//m.yohobuy.com',
        guang: '//guang.m.yohobuy.com',
        list: '//list.m.yohobuy.com',
        search: '//search.m.yohobuy.com',
        huodong: '//huodong.m.yohobuy.com',
        activity: '//activity.yohobuy.com',
        index: '//m.yohobuy.com'
    },
    useOneapm: false,
    useCache: false,
    memcache: {
        master: ['192.168.102.205:12111'],
        slave: ['192.168.102.205:12111'],
        session: ['192.168.102.205:12111'],
        timeout: 1000,
        retries: 0
    },
    interfaceShunt: {
        open: false
    },
    loggers: {
        infoFile: {
            name: 'info',
            level: 'info',
            filename: 'logs/info.log'
        },
        errorFile: {
            name: 'error',
            level: 'error',
            filename: 'logs/error.log',
            handleExceptions: true,
            maxFiles: 7
        },
        udp: { // send by udp
            measurement: 'yohobuy_wap_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: 'wx75e5a7c0c88e45c2',
            appSecret: 'ce21ae4a3f93852279175a167e54509b'
        }
    }
};

if (isProduction) {
    Object.assign(module.exports, {
        appName: 'm.yohobuy.com',
        assetUrl: '//cdn.yoho.cn/m-yohobuy-node/assets',
        domains: {
            api: 'http://api.yoho.yohoops.org/',
            service: 'http://service.yoho.yohoops.org/',
            liveApi: 'http://api.live.yoho.cn/'
        },
        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: 1000,
            retries: 0
        },
        useOneapm: true,
        useCache: true,
        interfaceShunt: {
            open: true,
            url: 'http://123.206.2.55/strategy'
        }
    });
} else if (isTest) {
    Object.assign(module.exports, {
        appName: 'm.yohobuy.com for test',
        assetUrl: '//cdn.yoho.cn/m-yohobuy-node/assets',
        domains: {
            api: 'http://api-test3.yohops.com:9999/',
            service: 'http://service-test3.yohops.com:9999/',
            liveApi: 'http://testapi.live.yohops.com:9999/'
        },
        memcache: {
            master: ['127.0.0.1:12111'],
            slave: ['127.0.0.1:12112'],
            session: ['127.0.0.1:12111'],
            timeout: 1000,
            retries: 0
        },
        useOneapm: true,
        useCache: true
    });
}