common.js 4.86 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',
    appVersion: '5.4', // 调用api的版本
    port: 6001,
    siteUrl: '//m.yohobuy.com',
    assetUrl: '//127.0.0.1:5001',
    testCode: 'yoho4946abcdef#$%&!@',
    domains: {
        api: 'http://dev-api.yohops.com:9999/',
        service: 'http://dev-service.yohops.com:9999/',
        liveApi: 'http://testapi.live.yohops.com:9999/',
        singleApi: 'http://api-test3.yohops.com:9999/',
        imSocket: 'ws://im.yohobuy.com:10240',
        imCs: 'http://im.yohobuy.com/api',
        imServer: 'http://im.yohobuy.com/server'

        // api: 'http://api.yoho.cn/',
        // service: 'http://service.yoho.cn/',
        // liveApi: 'http://api.live.yoho.cn/',
        // singleApi: 'http://single.yoho.cn/',
        // imSocket: 'wss://imsocket.yohobuy.com:443',
        // imCs: 'https://imhttp.yohobuy.com/api',
        // imServer: 'https://imhttp.yohobuy.com/server'
    },
    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'
    },
    useCache: false,
    memcache: {
        master: ['127.0.0.1:11211'],
        slave: ['127.0.0.1:11211'],
        session: ['127.0.0.1:11211'],
        timeout: 1000,
        retries: 0
    },
    interfaceShunt: {
        open: false
    },
    loggers: {
        infoFile: {
            close: true,
            name: 'info',
            level: 'error',
            filename: 'logs/info.log',
            maxFiles: 7
        },
        errorFile: {
            name: 'error',
            level: 'error',
            filename: 'logs/error.log',
            handleExceptions: true,
            maxFiles: 7
        },
        udp: { // send by udp
            measurement: 'yohobuy_wap_node_log',
            level: 'error', // logger level
            host: 'influxdblog.web.yohoops.org', // influxdb host
            port: '4444' // influxdb port
        },
        console: {
            level: 'info',
            colorize: 'all',
            prettyPrint: true
        }
    },
    thirdLogin: {
        wechat: {
            appID: 'wx75e5a7c0c88e45c2',
            appSecret: 'ce21ae4a3f93852279175a167e54509b'
        }
    },
    zookeeperServer: '192.168.102.168:2188',
    alipayConfig: {
        alipayKey: 'kcxawi9bb07mzh0aq2wcirsf9znusobw'
    }
};

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/',
            singleApi: 'http://single.yoho.cn/',
            imSocket: 'wss://imsocket.yohobuy.com:443',
            imCs: 'https://imhttp.yohobuy.com/api',
            imServer: 'https://imhttp.yohobuy.com/server'
        },
        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'],
            poolSize: 100,
            reconnect: 5000,
            timeout: 1000,
            retries: 0
        },
        useCache: true,
        interfaceShunt: {
            open: false,
            url: 'http://123.206.2.55/strategy'
        },
        zookeeperServer: 'web.zookeeper.yohoops.org:2181'
    });
} else if (isTest) {
    Object.assign(module.exports, {
        appName: 'm.yohobuy.com for test',
        assetUrl: '//cdn.yoho.cn/m-yohobuy-node/assets/',
        domains: {
            api: process.env.TEST_API || 'http://api-test1.yohops.com:9999/',
            service: process.env.TEST_SERVICE || 'http://service-test1.yohops.com:9999/',
            liveApi: process.env.TEST_LIVE || 'http://testapi.live.yohops.com:9999/',
            singleApi: process.env.TEST_SINGLE || 'http://api-test1.yohops.com:9999/',
            imSocket: process.env.TEST_IM_SOCKET || 'ws://socket.yohobuy.com:10240',
            imCs: process.env.TEST_IM_CS || 'http://im.yohobuy.com/api',
            imServer: process.env.TEST_IM_SERVER || 'http://im.yohobuy.com/server'
        },
        memcache: {
            master: ['127.0.0.1:12111'],
            slave: ['127.0.0.1:12112'],
            session: ['127.0.0.1:12111'],
            timeout: 100,
            reconnect: 5000,
            retries: 0
        },
        useCache: true
    });
}