common.js 7.31 KB
/**
 * 系统配置
 *
 * @author hbomb qiqi.zhou@yoho.cn
 * @date 2016/05/06
 */

const pkg = require('../package.json');

const isProduction = process.env.NODE_ENV === 'production';
const isTest = process.env.NODE_ENV === 'test3';

module.exports = {
    app: 'h5',
    appName: 'yoho-activity-platform',
    appVersion: '6.6.0', // 调用api的版本
    port: 6006,
    siteUrl: '//action.yoho.cn',
    assetUrl: `/yoho-activity-platform/${pkg.version}/`,

    // yohoVerifyUdid: '0f626ede-0e17-460b-a8ea-069ee506e8e9',
    domains: {
        api: 'http://api-test3.dev.yohocorp.com/',
        service: 'http://api-test3.dev.yohocorp.com/',
        singleApi: 'http://api-test3.yohops.com:9999/',

        // singleApi: 'http://api.yoho.cn/',
        // api: 'http://api.yoho.cn/',
        // service: 'http://service.yoho.cn/',
        store: 'http://192.168.102.47:8080/portal-gateway/wechat/',
        serviceNotify: 'http://service.yoho.cn/',
        platformApi: 'http://172.16.6.210:8088/',
    },
    from: {
        action: {
            business_line: 'yohobuy'
        }
    },
    zookeeperServer: '127.0.0.1:2181',
    corsAllowOrigin: [
        'http://localhost:8081',
        'http://localhost:8888',
        'http://localhost:1234',
        'http://localhost:63342',
        'http://huodong.yoho.cn',
        'http://yohood.ad.yoho.cn',
        'http://ad.yoho.cn',
        'https:/ad.yoho.cn',
        'http://ad.yhurl.com',
        'http://feature.yoho.cn',
        'https://feature.yoho.cn'
    ],
    useCache: false,
    interfaceShunt: {
        open: false
    },
    loggers: {
        infoFile: {
            name: 'info',
            level: 'info',
            filename: '/Data/log/yoho-activity-platform/info.log',
            maxFiles: 7
        },
        errorFile: {
            name: 'error',
            level: 'error',
            filename: '/Data/log/yoho-activity-platform/error.log',
            handleExceptions: true,
            maxFiles: 7
        },
        console: {
            level: 'info',
            colorize: 'all',
            prettyPrint: true
        }
    },
    redis: {
        connect: {
            host: '192.168.102.49',
            port: '6379',
            enable_offline_queue: false,
            retry_strategy(options) {
                if (options.error && options.error.code === 'ECONNREFUSED') {
                    console.log('connect redis server fail');
                }

                if (options.attempt < 10) {
                    return Math.min(options.attempt * 100, 1000);
                } else if (options.attempt > 10 && options.attempt < 100) {
                    return 1000;
                } else {
                    return 1000 * 10;
                }
            }
        }
    },

    // 数据上报
    monitorReport: {
        host: '192.168.102.22',
        port: 8086,
        db: 'web_monitor',
        immediate: true
    },
    mysql: {
        connect: {
            host: '192.168.102.219',
            port: '3306',
            user: 'yh_test',
            password: 'yh_test',
            charset: 'utf8mb4',
            timezone: '+08:00'
        },
        database: 'yoho_activity_platform',
    },
    qiniu: {
        ACCESS_KEY: 'BwWhoJN536BnV3CzlE20AjNKC9O2bP0l5tFpKsDU',
        SECRET_KEY: '_x2VtO7fEmylgjojmLi7qwTBtRm30S8BrO0FxOPK',
        BUCKET_NAME: 'cmsimg01'
    },
    qiniuYohoCdn: {
        ACCESS_KEY: 'BwWhoJN536BnV3CzlE20AjNKC9O2bP0l5tFpKsDU',
        SECRET_KEY: '_x2VtO7fEmylgjojmLi7qwTBtRm30S8BrO0FxOPK',
        ORIGIN: 'https://cdn.yoho.cn',
        BUCKET_NAME: 'yohocdn'
    },
    yohoSecret: '3bd815162342d9733f06ab6811082c64',
    wechat: {
        appID: 'wx1fe49f08f41b6c26', // jsapi 用
        appSecret: '1360c4a89275e1a4a4bbc8f6c5e44587',
        token: 'weixin',
        prefix: 'https://api.weixin.qq.com/cgi-bin/',
        mpPrefix: 'https://api.weixin.qq.com/cgi-bin/',
    },
    wechatLogin: {
        appID: 'wxb785b12717bc31e9',
        appSecret: 'fb0bc348577b1e38576c6fe654da5135',
    }
};

if (isProduction) {
    Object.assign(module.exports, {
        siteUrl: 'https://action.yoho.cn',
        assetUrl: `/yoho-activity-platform/${pkg.version}/`,
        domains: {
            api: 'http://api.yoho.yohoops.org/',
            store: 'https://openstore.yohobuy.com',
            service: 'http://api.yoho.yohoops.org/',
            global: 'http://api-global.yohobuy.com',
            liveApi: 'http://api.live.yoho.cn/',
            singleApi: 'http://single.yoho.cn/',
            platformApi: 'http://api.platform.yohoops.org'
        },
        corsAllowOrigin: [
            'http://ad.yoho.cn',
            'https://ad.yoho.cn',
            'http://feature.yoho.cn',
            'https://feature.yoho.cn',
            'http://yunhuodong.net',
            'http://huodong.yoho.cn',
            'https://huodong.yoho.cn',
            'http://ad.yhurl.com'
        ],
        zookeeperServer: 'web.zookeeper.yohoops.org:2181',
        redis: {
            connect: {
                host: 'redis.web.yohoops.org',
                port: '6379',
                password: 'redis9646',
                enable_offline_queue: false,
                retry_strategy(options) {
                    if (options.error && options.error.code === 'ECONNREFUSED') {
                        console.log('connect redis server fail');
                    }

                    if (options.attempt < 10) {
                        return Math.min(options.attempt * 100, 1000);
                    } else if (options.attempt > 10 && options.attempt < 100) {
                        return 1000;
                    } else {
                        return 1000 * 10;
                    }
                }
            }
        },
        report: {
            host: 'badjs.yohoops.org',
            port: 80,
            db: 'web-apm',
            immediate: true
        },

        // 数据上报
        monitorReport: {
            host: '10.66.4.25',
            port: 8086,
            db: 'web_monitor',
            immediate: true
        },
        useCache: true,
        mysql: {
            connect: {
                host: '10.66.106.4',
                port: '3306',
                user: 'yh_vpc_bak',
                password: 'yoho@2Y$^YpNb7hp',
                charset: 'utf8mb4',
                timezone: '+08:00'
            },
            database: 'yoho_activity_platform',
        }
    });
} else if (isTest) {
    Object.assign(module.exports, {
        siteUrl: '//action.yoho.cn',
        assetUrl: `/yoho-activity-platform/${pkg.version}/`,
        domains: {
            api: 'http://api-test3.dev.yohocorp.com/',
            service: 'http://api-test3.dev.yohocorp.com/',
            global: 'http://global-test-soa.yohops.com:9999/',
            store: 'http://192.168.102.210:8080/portal-gateway/wechat/',
            liveApi: 'http://testapi.live.yohops.com:9999/',
            singleApi: 'http://api-test3.dev.yohocorp.com/',
            platformApi: 'http://192.168.102.48:8088/'
        },
        useCache: true,
        zookeeperServer: 'zk01-yohoops-org:2181',
        mysql: {
            connect: {
                host: '192.168.102.219',
                port: '3306',
                user: 'yh_test',
                password: 'yh_test',
                charset: 'utf8mb4',
                timezone: '+08:00'
            },
            database: 'yoho_activity_platform',
        }
    });
}