common.js 5.5 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 === 'test';

module.exports = {
    app: 'h5',
    appVersion: '5.8.0', // 调用api的版本
    port: 6006,
    siteUrl: '//action.yoho.cn',
    assetUrl: `/yoho-activity-platform/${pkg.version}/`,
    domains: {
        // api: 'http://api-test3.yohops.com:9999/',
        // service: 'http://service-test3.yohops.com:9999/',
        // singleApi: 'http://api-test3.yohops.com:9999/'

        singleApi: 'http://api.yoho.cn/',
        api: 'http://api.yoho.cn/',
        service: 'http://api.yoho.cn/',
        serviceNotify: 'http://service.yoho.cn/',
        platformApi: 'http://172.16.6.210:8088/',
    },
    corsAllowOrigin: [
        'http://localhost:8081',
        'http://localhost:1234',
        'http://localhost:63342',
        'http://huodong.yoho.cn',
        'http://ad.yoho.cn',
        'https:/ad.yoho.cn',
        'http://ad.yhurl.com',
        'http://feature.yoho.cn'
    ],
    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: {
            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
        }
    },
    mysql: {
        connect: {
            host: 'localhost',
            port: '3306',
            user: 'root',
            password: '123456'
        },
        database: 'yoho_activity_platform',
    },
    qiniu: {
        ACCESS_KEY: 'BwWhoJN536BnV3CzlE20AjNKC9O2bP0l5tFpKsDU',
        SECRET_KEY: '_x2VtO7fEmylgjojmLi7qwTBtRm30S8BrO0FxOPK',
        BUCKET_NAME: 'cmsimg01'
    },
    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, {
        appName: 'm.yohobuy.com',
        siteUrl: 'https://action.yoho.cn',
        assetUrl: `/yoho-activity-platform/${pkg.version}/`,
        domains: {
            api: 'http://api.yoho.yohoops.org/',
            service: 'http://service.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://huodong.yoho.cn',
            'https://huodong.yoho.cn',
            'http://ad.yhurl.com'
        ],
        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: 1000,
            retries: 0
        },
        useCache: true,
        mysql: {
            connect: {
                host: '10.67.2.144',
                port: '3307',
                user: 'yh_vpc_bak',
                password: 'yoho@2Y$^YpNb7hp'
            },
            database: 'yoho_activity_platform',
        }
    });
} else if (isTest) {
    Object.assign(module.exports, {
        appName: 'm.yohobuy.com for test',
        siteUrl: '//action.yoho.cn',
        assetUrl: `/yoho-activity-platform/${pkg.version}/`,
        domains: {
            api: process.env.TEST_API || 'http://api-test1.yohops.com:9999/',
            service: process.env.TEST_SERVICE || 'http://service-test1.yohops.com:9999/',
            global: process.env.TEST_GLOBAL || 'http://global-test-soa.yohops.com:9999/',
            store: process.env.TEST_STORE || 'http://192.168.102.210:8080/portal-gateway/',
            liveApi: process.env.TEST_LIVE || 'http://testapi.live.yohops.com:9999/',
            singleApi: process.env.TEST_SINGLE || 'http://api-test1.yohops.com:9999/',
            platformApi: 'http://192.168.102.48:8088/'
        },
        memcache: {
            master: ['127.0.0.1:12111'],
            slave: ['127.0.0.1:12112'],
            session: ['127.0.0.1:12111'],
            timeout: 100,
            reconnect: 5000,
            retries: 0
        },
        useCache: true,
        mysql: {
            connect: {
                host: 'localhost',
                port: '3306',
                user: 'root',
                password: ''
            },
            database: 'yoho_activity_platform',
        }
    });
}