2021-03-03 12:35:45 +00:00
|
|
|
const config = require('../../shared/config');
|
|
|
|
const db = require('../data/db');
|
|
|
|
const LimitService = require('@tryghost/limit-service');
|
|
|
|
let limitService = new LimitService();
|
|
|
|
|
|
|
|
const initFn = () => {
|
|
|
|
let helpLink;
|
|
|
|
|
2021-03-04 11:34:11 +00:00
|
|
|
if (!config.get('hostSettings') || !config.get('hostSettings:limits')) {
|
2021-03-03 12:35:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-03-04 11:34:11 +00:00
|
|
|
if (config.get('hostSettings:billing:enabled') && config.get('hostSettings:billing:enabled') === true && config.get('hostSettings:billing:url')) {
|
|
|
|
helpLink = config.get('hostSettings:billing:url');
|
2021-03-03 12:35:45 +00:00
|
|
|
} else {
|
|
|
|
helpLink = 'https://ghost.org/help/';
|
|
|
|
}
|
|
|
|
|
2021-03-04 11:34:11 +00:00
|
|
|
limitService.loadLimits({limits: config.get('hostSettings:limits'), db, helpLink});
|
2021-03-03 12:35:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = limitService;
|
|
|
|
|
|
|
|
module.exports.init = initFn;
|