You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
closes BAE-331
We're introducing 3 new limits, which Ghost need to be aware of through the Limit-Service:
- `limitStripeConnect`
- `limitAnalytics`
- `limitActivityPub`
This adds those limits to the config, allowing them to be passed through to Ghost and being available for limit checks.
All of the new limits are `Flag` type limits and don't require a `currentCountQuery`.
// limitStripeConnect, limitAnalytics, and limitActivityPub
29
30
// all limit configs support custom "error" configuration that is a template string
30
31
constlimits= {
31
32
// staff and member are "max" type of limits accepting "max" configuration
@@ -65,7 +66,10 @@ const limits = {
65
66
max:5000000,
66
67
// formatting of the {{ max }} vairable is in MB, e.g: 5MB
67
68
error:'Your plan supports uploads of max size up to {{max}}. Please upgrade to reenable uploading.'
68
-
}
69
+
},
70
+
limitStripeConnect: {},
71
+
limitAnalytics: {},
72
+
limitActivityPub: {}
69
73
};
70
74
71
75
// This information is needed for the limit service to work with "max periodic" limits
@@ -160,9 +164,9 @@ At the moment there are four different types of limits that limit service allows
160
164
4.`allowList` - checks if provided value is defined in configured "allowlist". Example usecase: "disable theme activation if it is not an official theme". To configure this limit define ` allowlist: ['VALUE_1', 'VALUE_2', 'VALUE_N']` property in the "limits" parameter.
161
165
162
166
### Supported limits
163
-
There's a limited amount of limits that are supported by limit service. The are defined by "key" property name in the "config" module. List of currently supported limit names: `members`, `staff`, `customIntegrations`, `emails`, `customThemes`, `uploads`.
167
+
There's a limited amount of limits that are supported by limit service. The are defined by "key" property name in the "config" module. List of currently supported limit names: `members`, `staff`, `customIntegrations`, `emails`, `customThemes`, `uploads`, `limitStripeConnect`, `limitAnalytics`, and `limitActivityPub`.
164
168
165
-
All limits can act as `flag` or `allowList` types. Only certain (`members`, `staff`, and`customIntegrations`) can have a `max` limit. Only `emails` currently supports the `maxPeriodic` type of limit.
169
+
All limits can act as `flag` or `allowList` types. Only certain (`members`, `staff`) can have a `max` limit. Only `emails` currently supports the `maxPeriodic` type of limit.
166
170
167
171
### Frontend usage
168
172
In case the limit check is run without direct access to the database you can override `currentCountQuery` functions for each "max" or "maxPeriodic" 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:
0 commit comments