2021-04-07 06:31:44 +03:00
|
|
|
const errors = require('@tryghost/errors');
|
2021-03-03 15:35:45 +03: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 14:34:11 +03: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 15:35:45 +03:00
|
|
|
} else {
|
|
|
|
helpLink = 'https://ghost.org/help/';
|
|
|
|
}
|
|
|
|
|
2021-05-07 17:41:49 +03:00
|
|
|
let subscription;
|
|
|
|
|
|
|
|
if (config.get('hostSettings:subscription')) {
|
|
|
|
subscription = {
|
|
|
|
startDate: config.get('hostSettings:subscription:start'),
|
|
|
|
interval: 'month'
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
limitService.loadLimits({
|
|
|
|
limits: config.get('hostSettings:limits'),
|
|
|
|
subscription,
|
|
|
|
db,
|
|
|
|
helpLink,
|
|
|
|
errors
|
|
|
|
});
|
2021-03-03 15:35:45 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = limitService;
|
|
|
|
|
|
|
|
module.exports.init = initFn;
|