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

'use strict';

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

module.exports = {
    app: 'yoho-apm',
    appVersion: '0.0.1', // 调用api的版本
    port: 6009,
    siteUrl: '//shop.yohobuy.com',
    cookieDomain: '.yohobuy.com',
    domains: [/yohobuy\.com^/],
    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',
            prettyPrint: true
        }
    },
    sourceMap: {
        domain: 'http://static-ci.yoho.cn'
    },
    reportApi: {
        host: 'influxd.yoho.cn',
        db: 'web-apm',
        measurement: 'api-info',
        duration: 2000,
        records: 1
    },
    reportRoute: {
        host: 'influxd.yoho.cn',
        db: 'web-apm',
        measurement: 'route-info',
        duration: 2000,
        records: 1
    },
    mysql: {
        host: 'localhost',
        port: '3306',
        db: 'web-apm',
        userName: 'root',
        password: 'root'
    },
    table: {
        slow: 'slow_duration',
        error: 'error_report'
    },
    slowRoute: {
        min: 5 * 1000,
        max: 10 * 1000
    }
};

if (isProduction) {
    Object.assign(module.exports, {
        report: {
            host: '10.66.0.139',
            port: 8086,
            db: 'web-apm',
            measurement: 'api-duration',
            duration: 2000,
            records: 10
        },
        sourceMap: {
            domain: 'http://10.66.101.9:6006'
        },
        mysql: {
            host: '10.66.0.139',
            db: 'web-apm',
            userName: 'root',
            password: 'yB877Jy7tV6juIYk'
        }
    });
}
if (isTest) {
    Object.assign(module.exports, {
        report: {
            host: 'influxdblog.web.yohoops.org',
            db: 'web-apm',
            measurement: 'api-duration',
            duration: 2000,
            records: 10
        },
        sourceMap: {
            domain: 'http://10.66.101.9:6006'
        }
    });
}