Authored by 陈峰

config

... ... @@ -6,14 +6,16 @@
'use strict';
const isProduction = process.env.NODE_ENV === 'production';
const isTest = process.env.NODE_ENV === 'test';
//
const config = {
app: 'yoho-apm',
appVersion: '0.0.1', // 调用api的版本
port: 6003,
siteUrl: '//shop.yohobuy.com',
cookieDomain: '.yohobuy.com',
domains: [/yohobuy\.com^/],
loggers: {
infoFile: {
close: true,
... ... @@ -44,5 +46,28 @@ const config = {
}
};
if (isProduction) {
Object.assign(module.exports, {
report: {
host: 'influxdblog.web.yohoops.org',
db: 'web-apm',
measurement: 'api-duration',
duration: 2000,
records: 10
}
});
}
if (isTest) {
Object.assign(module.exports, {
report: {
host: 'influxdblog.web.yohoops.org',
db: 'web-apm',
measurement: 'api-duration',
duration: 2000,
records: 10
}
});
}
module.exports = config;
... ...
... ... @@ -7,17 +7,18 @@ const flow = fp.map(fp.fromPairs);
const resolveStr = (str, level = 0) => {
let sp = [];
const tp = _.split(str, splits[level]);
_.each(tp, child => {
if (child.indexOf(splits[level + 1]) >= 0) {
sp.push(resolveStr(child, level + 1));
}
})
});
return sp.length ? sp : tp;
}
};
const parse = (str) => {
return fp.pipe(resolveStr, flow)(str)
}
return fp.pipe(resolveStr, flow)(str);
};
module.exports = {
parse
... ...
... ... @@ -2,4 +2,4 @@ const apm = require('./apm');
module.exports = {
apm
}
\ No newline at end of file
};
... ...