common.js 5.08 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: '5.3.0', // 调用api的版本
    port: 6002,
    siteUrl: 'http://www.yohobuy.com',
    cookieDomain: '.yohobuy.com',
    domains: {
        favApi: 'http://192.168.102.31:8092/brower',

        api: 'http://api-test2.yohops.com:9999/',
        service: 'http://service-test2.yohops.com:9999/',

        // api: 'http://api.yoho.cn/',
        // service: 'http://service.yoho.cn/',

        // api: 'http://192.168.102.205:8080/gateway/',
        // service: 'http://dev-service.yohops.com:9999/',
        search: 'http://192.168.102.216:8080/yohosearch/',

        imSocket: 'wss://imsocket.yohobuy.com:443',
        imCs: 'https://imhttp.yohobuy.com/api',
        imServer: 'https://imhttp.yohobuy.com/server'
    },
    subDomains: {
        host: '.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: '//yohobuy.com'
    },
    useOneapm: false,
    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: 'info',
            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_node_log',
            level: 'debug', // logger level
            host: 'influxdblog.web.yohoops.org', // influxdb host
            port: '4444' // influxdb port
        },
        console: {
            level: 'info',
            colorize: 'all',
            prettyPrint: true
        }
    },
    thirdLogin: {
        wechat: {
            appID: 'wx3ae21dcbb82ad672',
            appSecret: 'e78afb2321e6a19085767e1a0f0d52c1'
        },
        sina: {
            appID: '3739328910',
            appSecret: '9d44cded26d048e23089e5e975c93df1'
        },
        qq: {
            appID: '100229394',
            appSecret: 'c0af9c29e0900813028c2ccb42021792'
        },
        alipay: {
            appID: '2088701661478015',
            appSecret: 'kcxawi9bb07mzh0aq2wcirsf9znusobw'
        },
        douban: {
            appID: '03b4e36bf13dc75a0b1eaa43d3b9560e',
            appSecret: 'f16d5913e8610672'
        },
        renren: {
            appID: '783130c654c94a77ace97054ae266019',
            appSecret: '05e430de8c1e40d3a1f39ca8d3f8252c'
        }
    },
    apiCache: {
        cache: true
    },
    zookeeperServer: '192.168.102.168:2188'
};

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/',
            imSocket: 'ws://imsocket.yohobuy.com:10000',
            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: 300,
            retries: 0,
            retry: 3000
        },
        useOneapm: true,
        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: 'www.yohobuy.com for test',
        domains: {
            favApi: 'http://192.168.102.31:8092/brower',
            api: process.env.TEST_API || 'http://testapi.yoho.cn:28078/',
            service: process.env.TEST_SERVICE || 'http://testservice.yoho.cn:28077/',
            search: process.env.TEST_SEARCH || 'http://192.168.102.216:8080/yohosearch/',
            imSocket: 'ws://socket.yohobuy.com:10240',
            imCs: 'http://im.yohobuy.com/api',
            imServer: 'http://im.yohobuy.com/server'
        },
        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
        }
    });
}