Blame view

config/common.js 10.5 KB
周奇琪 authored
1 2
/**
 * 系统配置
3
 *
周奇琪 authored
4
 * @author hbomb qiqi.zhou@yoho.cn
5
 * @date 2016/05/06
周奇琪 authored
6 7
 */
lijing authored
8
const pkg = require('../package.json');
周奇琪 authored
9 10 11 12

const isProduction = process.env.NODE_ENV === 'production';
const isTest = process.env.NODE_ENV === 'test';
郭成尧 authored
13
const domains = {
郝肖肖 authored
14
郭成尧 authored
15 16
    api: 'http://api.yoho.cn/',
    service: 'http://service.yoho.cn/',
17
    liveApi: 'http://testapi.live.yohops.com:9999/',
李靖 authored
18
    singleApi: 'http://api-test3.yohops.com:9999/',
郝肖肖 authored
19 20 21 22 23 24 25 26 27 28 29 30 31

    // gray
    // singleApi: 'http://single.gray.yohops.com/',
    // api: 'http://apigray.yoho.cn/',
    // service: 'http://apigray.yoho.cn/',
    // platformApi: 'http://172.16.6.210:8088/',


    // api: 'http://api-test3.yohops.com:9999/',
    // service: 'http://service-test3.yohops.com:9999/',
    // liveApi: 'http://testapi.live.yohops.com:9999/',
    // singleApi: 'http://api-test3.yohops.com:9999/',
32
    imSocket: 'ws://socket.yohobuy.com:10240',
李靖 authored
33
    imCs: 'http://im.yohobuy.com/api',
李靖 authored
34 35
    global: 'http://api-global.yohobuy.com',
    store: 'http://192.168.102.47:8080/portal-gateway/',
李靖 authored
36
    platformApi: 'http://192.168.102.48:8088/',
37
    extstore: 'http://extstore-test1.yohops.com',
李靖 authored
38
    family: 'http://192.168.103.73:8096/uic/',
39
    yohoNowApi: 'http://yohonow-test.yohops.com:9999/'
郭成尧 authored
40 41
};
周奇琪 authored
42
module.exports = {
43
    app: 'h5',
毕凯 authored
44
    appVersion: '6.4.0', // 调用api的版本
htoooth authored
45
    appName: 'yohobuywap-node',
46
    port: 6001,
ccbikai authored
47
    siteUrl: '//m.yohobuy.com',
陈轩 authored
48
    assetUrl: '//127.0.0.1:5001',
陈轩 authored
49
    testCode: 'yoho4946abcdef#$%&!@',
郭成尧 authored
50
    domains: domains,
周奇琪 authored
51
    report: {
htoooth authored
52 53
        host: 'badjs.yoho.cn',
        port: 80,
周奇琪 authored
54 55
        db: 'web-apm'
    },
ccbikai authored
56 57 58 59 60 61 62 63 64 65
    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'
    },
ccbikai authored
66
    useCache: false,
67
    memcache: {
陈轩 authored
68 69
        master: ['127.0.0.1:11211'],
        session: ['127.0.0.1:11211'],
ccbikai authored
70 71
        timeout: 1000,
        retries: 0
72
    },
梁志锋 authored
73
    interfaceShunt: {
姜枫 authored
74
        open: false
梁志锋 authored
75
    },
周奇琪 authored
76
    loggers: {
周奇琪 authored
77
        infoFile: {
姜枫 authored
78
            close: true,
周奇琪 authored
79
            name: 'info',
80
            level: 'error',
周奇琪 authored
81
            filename: 'logs/info.log',
周奇琪 authored
82
            maxFiles: 7
周奇琪 authored
83
        },
周奇琪 authored
84
        errorFile: {
zhangxiaoru authored
85
            close: true,
周奇琪 authored
86 87
            name: 'error',
            level: 'error',
ccbikai authored
88
            filename: 'logs/error.log',
周奇琪 authored
89 90
            handleExceptions: true,
            maxFiles: 7
周奇琪 authored
91
        },
毕凯 authored
92
        console: {
郭成尧 authored
93
            level: 'debug',
94
            colorize: 'all',
郭成尧 authored
95 96
            prettyPrint: true,
            debugStdout: true
97
        }
姜枫 authored
98
    },
ccbikai authored
99 100
    thirdLogin: {
        wechat: {
ccbikai authored
101 102
            appID: 'wx75e5a7c0c88e45c2',
            appSecret: 'ce21ae4a3f93852279175a167e54509b'
ccbikai authored
103
        }
徐祁xuqi authored
104
    },
陈峰 authored
105
    zookeeperServer: '127.0.0.1:2181',
郭成尧 authored
106
    alipayConfig: {
郭成尧 authored
107
        payUrl: 'https://mapi.alipay.com/gateway.do',
郭成尧 authored
108 109 110
        service: 'alipay.wap.create.direct.pay.by.user',
        partner: '2088701661478015',
        inputCharset: 'utf-8',
郭成尧 authored
111
        notifyUrl: domains.service + 'payment/alipay_notify',
郭成尧 authored
112 113 114 115 116
        returnUrl: '/shopping/pay/aliwapreturn',
        signType: 'MD5',
        paymentType: '1',
        alipayKey: 'kcxawi9bb07mzh0aq2wcirsf9znusobw',
        sellerMail: 'zfb@yoho.cn',
郭成尧 authored
117
        merchantUrl: 'http://m.yohobuy.com/home/orderDetail?order_code='
郭成尧 authored
118 119
    },
    WxPayConfig: {
郭成尧 authored
120 121 122 123
        appId: 'wx75e5a7c0c88e45c2',
        mchId: '1227694201',
        key: '7e6f3307b64cc87c79c472814b88f7fb',
        appSecret: 'ce21ae4a3f93852279175a167e54509b',
郭成尧 authored
124
        notifyUrl: domains.service + 'payment/weixin_notify',
姜枫 authored
125
    },
陈峰 authored
126
    maxQps: 1200,
毕凯 authored
127
    maxQps10m: 2500,
lijing authored
128
    geetestJs: '//static.geetest.com/static/tools/gt.js',
郭成尧 authored
129
    jsSdk: '//cdn.yoho.cn/js-sdk/1.2.10/jssdk.js',
shijian authored
130 131
    redis: {
        connect: {
郭成尧 authored
132
            host: '127.0.0.1',
shijian authored
133 134 135 136 137
            port: '6379',
            retry_strategy(options) {
                if (options.error && options.error.code === 'ECONNREFUSED') {
                    console.log('redis连接不成功');
                }
shijian authored
138
                if (options.total_retry_time > 1000 * 60 * 60 * 6) {
shijian authored
139 140 141 142
                    console.log('redis连接超时');
                    return;
                }
                if (options.attempt > 10) {
shijian authored
143
                    return 1000 * 60 * 60 * 0.5;
shijian authored
144 145 146 147
                }
                return Math.min(options.attempt * 100, 1000);
            }
        }
郭成尧 authored
148 149
    },
    superCapture: '93c70db61fe276f93ce781ad17dc47cd'
150
};
周奇琪 authored
151 152 153

if (isProduction) {
    Object.assign(module.exports, {
郭成尧 authored
154
        assetUrl: `//cdn.yoho.cn/yohobuywap-node/${pkg.version}/`,
ccbikai authored
155 156
        domains: {
            api: 'http://api.yoho.yohoops.org/',
李靖 authored
157
            service: 'http://api.yoho.yohoops.org/',
lijing authored
158
            global: 'http://api-global.yohobuy.com',
李靖 authored
159
            store: 'http://openstore.yohobuy.com',
160
            liveApi: 'http://api.live.yoho.cn/',
陈轩 authored
161
            singleApi: 'http://single.yoho.cn/',
陈轩 authored
162
            imSocket: 'wss://imsocket.yohobuy.com:443',
李靖 authored
163
            imCs: 'https://imhttp.yohobuy.com/api',
李靖 authored
164
            platformApi: 'http://api.platform.yohoops.org',
165
            extstore: 'http://extstore.yohobuy.com',
郭成尧 authored
166
            family: 'http://uic.yohoops.org/uic/',
167
            yohoNowApi: 'http://new.yohoboys.com/'
ccbikai authored
168 169
        },
        memcache: {
毕凯 authored
170 171 172 173 174 175 176 177 178 179 180 181
            master: [
                'memcache1.yohoops.org:12111',
                'memcache2.yohoops.org:12111',
                'memcache3.yohoops.org:12111',
                'memcache4.yohoops.org:12111'
            ],
            session: [
                'memcache1.yohoops.org:12111',
                'memcache2.yohoops.org:12111',
                'memcache3.yohoops.org:12111',
                'memcache4.yohoops.org:12111'
            ],
182
            poolSize: 100,
姜枫 authored
183
            reconnect: 5000,
姜枫 authored
184
            timeout: 1000,
ccbikai authored
185
            retries: 0
ccbikai authored
186
        },
187 188
        useCache: true,
        interfaceShunt: {
ccbikai authored
189
            open: false,
姜枫 authored
190
            url: 'http://123.206.2.55/strategy'
陈峰 authored
191
        },
郭成尧 authored
192 193 194 195 196 197
        zookeeperServer: 'web.zookeeper.yohoops.org:2181',
        alipayConfig: {
            payUrl: 'https://mapi.alipay.com/gateway.do',
            service: 'alipay.wap.create.direct.pay.by.user',
            partner: '2088701661478015',
            inputCharset: 'utf-8',
郭成尧 authored
198
            notifyUrl: 'http://service.yoho.cn/payment/alipay_notify',
郭成尧 authored
199 200 201 202 203 204 205 206 207 208 209 210
            returnUrl: '/shopping/pay/aliwapreturn',
            signType: 'MD5',
            paymentType: '1',
            alipayKey: 'kcxawi9bb07mzh0aq2wcirsf9znusobw',
            sellerMail: 'zfb@yoho.cn',
            merchantUrl: 'http://m.yohobuy.com/home/orderDetail?order_code='
        },
        WxPayConfig: {
            appId: 'wx75e5a7c0c88e45c2',
            mchId: '1227694201',
            key: '7e6f3307b64cc87c79c472814b88f7fb',
            appSecret: 'ce21ae4a3f93852279175a167e54509b',
郭成尧 authored
211
            notifyUrl: 'http://service.yoho.cn/payment/weixin_notify',
shijian authored
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
        },
        redis: {
            connect: {
                host: 'web.redis.yohoops.org'
            },
            port: '6379',
            retry_strategy(options) {
                if (options.error && options.error.code === 'ECONNREFUSED') {
                    console.log('redis连接不成功');
                }
                if (options.total_retry_time > 1000 * 60 * 60 * 6) {
                    console.log('redis连接超时');
                    return;
                }
                if (options.attempt > 10) {
                    return 1000 * 60 * 60 * 0.5;
                }
                return Math.min(options.attempt * 100, 1000);
            }
231 232
        },
        report: {
htoooth authored
233 234
            host: 'badjs.yoho.cn',
            port: 80,
235
            db: 'web-apm'
郭成尧 authored
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
        },
        loggers: {
            infoFile: {
                close: true,
                name: 'info',
                level: 'error',
                filename: 'logs/info.log',
                maxFiles: 7
            },
            errorFile: {
                close: true,
                name: 'error',
                level: 'error',
                filename: 'logs/error.log',
                handleExceptions: true,
                maxFiles: 7
            },
            console: {
                level: 'info',
                colorize: 'all',
郭成尧 authored
256 257
                prettyPrint: true,
                debugStdout: true
郭成尧 authored
258
            }
郭成尧 authored
259
        }
周奇琪 authored
260 261 262
    });
} else if (isTest) {
    Object.assign(module.exports, {
郭成尧 authored
263
        assetUrl: `//cdn.yoho.cn/yohobuywap-node/${pkg.version}/`,
ccbikai authored
264
        domains: {
ccbikai authored
265
            api: process.env.TEST_API || 'http://api-test1.yohops.com:9999/',
李靖 authored
266
            service: process.env.TEST_API || 'http://api-test1.yohops.com:9999/',
lijing authored
267
            global: process.env.TEST_GLOBAL || 'http://global-test-soa.yohops.com:9999/',
李靖 authored
268
            store: process.env.TEST_STORE || 'http://192.168.102.210:8080/portal-gateway/wechat/',
269
            liveApi: process.env.TEST_LIVE || 'http://testapi.live.yohops.com:9999/',
陈轩 authored
270 271
            singleApi: process.env.TEST_SINGLE || 'http://api-test1.yohops.com:9999/',
            imSocket: process.env.TEST_IM_SOCKET || 'ws://socket.yohobuy.com:10240',
李靖 authored
272
            imCs: process.env.TEST_IM_CS || 'http://im.yohobuy.com/api',
李靖 authored
273
            platformApi: 'http://192.168.102.48:8088/',
274
            extstore: 'http://extstore-test1.yohops.com',
李靖 authored
275
            family: 'http://192.168.102.31:8096/uic/',
276
            yohoNowApi: process.env.YOHO_NOW_API || 'http://yohonow-test.yohops.com:9999/'
张丽霞 authored
277
        },
278
        memcache: {
毕凯 authored
279 280
            master: ['127.0.0.1:12111'],
            session: ['127.0.0.1:12111'],
ccbikai authored
281
            timeout: 100,
姜枫 authored
282
            reconnect: 5000,
ccbikai authored
283
            retries: 0
张丽霞 authored
284
        },
郭成尧 authored
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
        useCache: true,
        alipayConfig: {
            payUrl: 'https://mapi.alipay.com/gateway.do',
            service: 'alipay.wap.create.direct.pay.by.user',
            partner: '2088701661478015',
            inputCharset: 'utf-8',
            notifyUrl: (process.env.TEST_SERVICE || 'http://service-test1.yohops.com:9999/') + 'payment/alipay_notify',
            returnUrl: '/shopping/pay/aliwapreturn',
            signType: 'MD5',
            paymentType: '1',
            alipayKey: 'kcxawi9bb07mzh0aq2wcirsf9znusobw',
            sellerMail: 'zfb@yoho.cn',
            merchantUrl: 'http://m.yohobuy.com/home/orderDetail?order_code='
        },
        WxPayConfig: {
            appId: 'wx75e5a7c0c88e45c2',
            mchId: '1227694201',
            key: '7e6f3307b64cc87c79c472814b88f7fb',
            appSecret: 'ce21ae4a3f93852279175a167e54509b',
            notifyUrl: (process.env.TEST_SERVICE || 'http://service-test1.yohops.com:9999/') + 'payment/weixin_notify',
        }
周奇琪 authored
306
    });
ccbikai authored
307
}