common.js 5.34 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.9.0', // 调用api接口版本
    port: 6003,
    siteUrl: '//www.yohoblk.com',
    signExtend: {
        app_type: 1
    },
    subDomains: {
        default: '//www.yohoblk.com'
    },
    cookieDomain: 'yohoblk.com',
    domains: {
        // favApi: 'http://192.168.102.31:8092/brower',
        // api: 'http://192.168.102.205:8080/gateway/',
        // service: 'http://192.168.102.205:8080/gateway/',
        // search: 'http://192.168.102.216:8080/yohosearch/'

        singleApi: 'http://single.yoho.cn/',
        api: 'http://api.yoho.yohoops.org/',
        service: 'http://service.yoho.yohoops.org/',
        search: 'http://search.yohoops.org/yohosearch/'

        // singleApi: 'http://single.yoho.cn/',
        // api: 'http://api-test3.yohops.com:9999/',
        // service: 'http://service-test3.yohops.com:9999/',
        // search: 'http://search.yohoops.org/yohosearch/'

        // api: 'http://dev-api.yohops.com:9999/',
        // service: 'http://dev-service.yohops.com:9999/',
        // singleApi: 'http://api-test1.yohops.com:9999/',
        // search: 'http://search.yohoops.org/yohosearch/'
    },
    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: {
        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,
            maxFiles: 7
        },
        udp: { // send by udp
            measurement: 'yohoblk_pc_log',
            level: 'debug', // logger level
            host: 'influxdblog.yohoops.org', // influxdb host
            port: '4444' // influxdb port
        },
        console: {
            level: 'debug',
            colorize: 'all',
            prettyPrint: true
        }
    },
    thirdLogin: {
        wechat: { // OK
            appID: 'wx179ea6ff85adc828',
            appSecret: '19533c8674c1382aa9869bf5bc8d2fe7'
        },
        qq: {  // OK
            appID: '100229394',
            appSecret: 'c0af9c29e0900813028c2ccb42021792'
        },
        alipay: { // OK
            partnerID: '2088421464239504',
            appSecret: 'e3i54meghrac3qhryzhw1h5yzeijik7e'
        },
        sina: { // OK
            appID: '1379621535',
            appSecret: 'aa29bf39b5fd9f247c93e900d679ab6a'
        }
    },
    pay: {
        serviceNotify: 'http://service-test3.yohops.com:9999/'
    },
    crypto: {
        common: 'yohoblk9646abcde'
    }
};

if (isProduction) {
    Object.assign(module.exports, {
        appName: 'www.yohoblk.com',
        domains: {
            singleApi: 'http://single.yoho.cn/',
            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,
        pay: {
            serviceNotify: 'http://service.yoho.cn/'
        },
        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.yohoblk.com for test',
        domains: {
            singleApi: 'http://192.168.102.31:8092/',
            api: process.env.TEST_API || 'http://api-test3.yohops.com:9999/',
            service: process.env.TEST_SERVICE || 'http://service-test3.yohops.com:9999/',
            search: process.env.TEST_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
        },
        pay: {
            serviceNotify: 'http://service-test3.yohops.com:9999/'
        }
    });
}