config.js 1.38 KB
/**
 * config.js
 * @author: feng.chen<feng.chen@yoho.cn>
 * @date: 2017/04/13
 */

'use strict';
const _ = require('lodash');
const apiDomain = require('./api-domain');

const isProd = process.env.NODE_ENV === 'production';
const isTest = process.env.NODE_ENV === 'test';

//
const config = {
    app: 'shop-manage',
    appVersion: '0.0.1', // 调用api的版本
    platform: 2,
    port: 6007,
    siteUrl: '//shop.yohobuy.com',
    assetUrl: '//127.0.0.1:5001',
    cookieDomain: '.yohobuy.com',
    apiDomain: apiDomain,
    loggers: {
        infoFile: {
            close: true,
            name: 'info',
            level: 'error',
            filename: 'logs/info.log',
            maxFiles: 7
        },
        errorFile: {
            name: 'error',
            level: 'error',
            filename: 'logs/error.log',
            handleExceptions: true,
            maxFiles: 7
        },
        console: {
            level: 'info',
            colorize: 'all',
            prettyPrint: true
        }
    },
    memcache: {
        session: ''
    }
};

if (isTest) {
    _.merge(config, {
        apiDomain: {
            platform: 'http://10.66.100.6:8088/platform'
        }
    });
}

if (isProd) {
    _.merge(config, {
        apiDomain: {
            platform: 'http://172.31.23.161:8088/platform',
            erp: 'http://192.168.103.82:9098'
        }
    });
}

module.exports = config;