// currently supported limit keys are: staff, members, customThemes, customIntegrations
// all limit configs support custom "error" configuration that is a template string
const limits = {
// staff and member are "max" type of limits accepting "max" configuration
staff: {
max: 1,
error: 'Your plan supports up to {{max}} staff users. Please upgrade to add more.'
},
members: {
max: 1000,
error: 'Your plan supports up to {{max}} members. Please upgrade to reenable publishing.'
},
// customThemes and customIntegrations are "flag" type of limits accepting disabled boolean configuration
customThemes: {
disabled: true,
error: 'All our official built-in themes are available the Starter plan, if you upgrade to one of our higher tiers you will also be able to edit and upload custom themes for your site.'
},
customIntegrations: {
disabled: true,
error: 'You can use all our official, built-in integrations on the Starter plan. If you upgrade to one of our higher tiers, you’ll also be able to create and edit custom integrations and API keys for advanced workflows.'
}
};
// initialize the URL linking to help documentation etc.
const helpLink = 'https://ghost.org/help/';
// initialize knex db connection for the limit service to use when running query checks
In case the limit check is run without direct access to the database you can override `currentCountQuery` functions for each "max" type of limit. An example usecase would be a frontend client running in a browser. A browser client can check the limit data through HTTP request and then provide that data to the limit service. Example code to do exactly that:
Errors returned by the limit service can be customized. When configuring the limit service through `loadLimits` method `limits` objects can specify an `error` property that is a template string. Additionally, "MaxLimit" limit type supports following variables- {{count}} and {{max}}.
An example configuration for "MaxLimit" limit using an error template can look like following:
```json
"staff": {
"max": 5,
"error": "Your plan supports up to {{max}} staff users and you currently have {{count}}. Please upgrade to add more."