2694cb6b87
- I have a hunch that config.get isn't that performant - This calls config.get less times to hopefully get a tiny boost - This probably isn't much more readable, but it is a lot less duplication... if it doesn't get us a slight perf boost its pure taste and can be put back
25 lines
674 B
JavaScript
25 lines
674 B
JavaScript
const config = require('./core/shared/config');
|
|
const ghostVersion = require('@tryghost/version');
|
|
|
|
// Config for logging
|
|
const loggingConfig = config.get('logging') || {};
|
|
|
|
if (!loggingConfig.path) {
|
|
loggingConfig.path = config.getContentPath('logs');
|
|
}
|
|
|
|
// Additional values used by logging
|
|
loggingConfig.env = config.get('env');
|
|
loggingConfig.domain = config.get('url');
|
|
|
|
// Config for metrics
|
|
loggingConfig.metrics = config.get('logging:metrics') || {};
|
|
loggingConfig.metrics.metadata = {
|
|
// Undefined if unavailable
|
|
siteId: config.get('hostSettings:siteId'),
|
|
domain: config.get('url'),
|
|
version: ghostVersion.safe
|
|
};
|
|
|
|
module.exports = loggingConfig;
|