mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Added support for max periodic limit check
refs https://github.com/TryGhost/Team/issues/588 - This is a new type of limit allowing to measure resource use (e.g. sent emails) per period (e.g. subscription, billing, cycle, etc) - To enable periodical limit add following values under `hostSettings.limits`: ``` "emails": { "maxPeriodic": 10, "error": "Your plan supports up to {{max}} emails. Please upgrade to reenable sending emails." } ``` and following under `hostSettings.subscription`: ``` "subscription": { "start": "2020-04-02T15:53:55.000Z", "interval": "month" } ``` - Above config would allow checking if 10 emails per month starting on the 2nd of every month has been reached untill now
This commit is contained in:
parent
fbd03525b0
commit
d72ba77aba
3 changed files with 27 additions and 6 deletions
|
@ -13,7 +13,22 @@ const initFn = () => {
|
|||
helpLink = 'https://ghost.org/help/';
|
||||
}
|
||||
|
||||
limitService.loadLimits({limits: config.get('hostSettings:limits'), db, helpLink, errors});
|
||||
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
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = limitService;
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
"@tryghost/kg-default-cards": "4.0.3",
|
||||
"@tryghost/kg-markdown-html-renderer": "4.0.2",
|
||||
"@tryghost/kg-mobiledoc-html-renderer": "4.0.0",
|
||||
"@tryghost/limit-service": "0.4.3",
|
||||
"@tryghost/limit-service": "0.5.0",
|
||||
"@tryghost/magic-link": "1.0.2",
|
||||
"@tryghost/members-api": "1.4.0",
|
||||
"@tryghost/members-csv": "1.0.0",
|
||||
|
|
14
yarn.lock
14
yarn.lock
|
@ -714,12 +714,13 @@
|
|||
dependencies:
|
||||
"@tryghost/kg-clean-basic-html" "^1.0.17"
|
||||
|
||||
"@tryghost/limit-service@0.4.3":
|
||||
version "0.4.3"
|
||||
resolved "https://registry.yarnpkg.com/@tryghost/limit-service/-/limit-service-0.4.3.tgz#2594941c14b14fc9e99846a13fd218ecbbe253b3"
|
||||
integrity sha512-ZdiT5irH6+EUXKw/8ie9CccDfhpS6CbnW0WtzvLbHWP7nPfbZ2iXasmdhNYugHeWHJcZyW41CrKBM/qIxvDUNQ==
|
||||
"@tryghost/limit-service@0.4.4":
|
||||
version "0.4.4"
|
||||
resolved "https://registry.yarnpkg.com/@tryghost/limit-service/-/limit-service-0.4.4.tgz#09c0cbb7c32dc88226f6658b3ef15354d75e81f7"
|
||||
integrity sha512-ZYP1TOUqcdOiq2eArOOKvZD5zW6pioLesdp7EK9L2Bgv90doU8qotTqMjuKdkyeMFjcmkYwTNkawNg3oaGpyhg==
|
||||
dependencies:
|
||||
lodash "^4.17.21"
|
||||
luxon "^1.26.0"
|
||||
|
||||
"@tryghost/magic-link@1.0.2", "@tryghost/magic-link@^1.0.2":
|
||||
version "1.0.2"
|
||||
|
@ -6141,6 +6142,11 @@ lru_map@^0.3.3:
|
|||
resolved "https://registry.yarnpkg.com/lru_map/-/lru_map-0.3.3.tgz#b5c8351b9464cbd750335a79650a0ec0e56118dd"
|
||||
integrity sha1-tcg1G5Rky9dQM1p5ZQoOwOVhGN0=
|
||||
|
||||
luxon@^1.26.0:
|
||||
version "1.26.0"
|
||||
resolved "https://registry.yarnpkg.com/luxon/-/luxon-1.26.0.tgz#d3692361fda51473948252061d0f8561df02b578"
|
||||
integrity sha512-+V5QIQ5f6CDXQpWNICELwjwuHdqeJM1UenlZWx5ujcRMc9venvluCjFb4t5NYLhb6IhkbMVOxzVuOqkgMxee2A==
|
||||
|
||||
mailcomposer@~0.2.10:
|
||||
version "0.2.12"
|
||||
resolved "https://registry.yarnpkg.com/mailcomposer/-/mailcomposer-0.2.12.tgz#4d02a604616adcb45fb36d37513f4c1bd0b75681"
|
||||
|
|
Loading…
Add table
Reference in a new issue