common.js 4.31 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.2.0', // 调用api的版本
    port: 6004,
    siteUrl: '//m.yohoblk.com',
    signExtend: {
        app_type: 1
    },
    domains: {
        //api: 'http://api-test3.yohops.com:9999/',
        //service: 'http://service-test3.yohops.com:9999/',

        /* api: 'http://dev-api.yohops.com:9999/',
        service: 'http://dev-service.yohops.com:9999/',*/
        //singleApi: 'http://192.168.102.27:8092/'

        api: 'http://api.yoho.cn/',
        service: 'http://service.yoho.cn/',
        singleApi: 'http://single.yoho.cn/'
        /* singleApi: 'http://192.168.102.205:8080/gateway/',//'http://single.yoho.cn/',
        api: 'http://192.168.102.205:8080/gateway/',//'http://api.yoho.cn/',
        service: 'http://192.168.102.205:8080/gateway/'//'http://service.yoho.cn/'*/
    },
    subDomains: {
        host: '.m.yohoblk.com',
        default: '//m.yohoblk.com',
        index: '//m.yohoblk.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: {
        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
            level: 'debug', // logger level
            host: 'influxdblog.yohoops.org', // influxdb host
            port: '4444' // influxdb port
        },
        console: {
            level: 'info',
            colorize: 'all',
            prettyPrint: true
        }
    },
    thirdLogin: {
        wechat: {
            appID: 'wx75e5a7c0c88e45c2',
            appSecret: 'ce21ae4a3f93852279175a167e54509b'
        }
    }
};

if (isProduction) {
    Object.assign(module.exports, {
        appName: 'm.yohoblk.com',
        domains: {
            api: 'http://api.yoho.yohoops.org/',
            service: 'http://service.yoho.yohoops.org/',
            singleApi: 'http://single.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: 100,
            retries: 0
        },
        useOneapm: true,
        useCache: true,
        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: 'm.yohoblk.com for test',
        domains: {
            api: process.env.TEST_API || 'http://api-test1.yohops.com:9999/',
            service: process.env.TEST_SERVICE || 'http://service-test1.yohops.com:9999/',
            singleApi: process.env.TEST_SINGLE || 'http://api-test1.yohops.com:9999/'
        },
        memcache: {
            master: ['127.0.0.1:12111'],
            slave: ['127.0.0.1:12112'],
            session: ['127.0.0.1:12111'],
            timeout: 100,
            retries: 0
        },
        useOneapm: true,
        useCache: true
    });
}