kuzzle 2.16.4 → 2.16.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/controllers/authController.js +2 -2
- package/lib/api/controllers/collectionController.js +2 -8
- package/lib/api/controllers/serverController.js +27 -14
- package/lib/config/default.config.d.ts +13 -0
- package/lib/config/default.config.js +363 -362
- package/lib/config/index.js +7 -5
- package/lib/core/backend/backendConfig.d.ts +3 -3
- package/lib/core/backend/backendConfig.js +2 -2
- package/lib/model/security/profile.js +10 -10
- package/lib/model/security/role.js +3 -3
- package/lib/service/cache/redis.js +33 -0
- package/lib/service/storage/elasticsearch.js +6 -0
- package/lib/types/PasswordPolicy.d.ts +77 -0
- package/lib/types/PasswordPolicy.js +3 -0
- package/lib/types/ProfileDefinition.d.ts +48 -0
- package/lib/types/ProfileDefinition.js +3 -0
- package/lib/types/RoleDefinition.d.ts +27 -0
- package/lib/types/RoleDefinition.js +3 -0
- package/lib/types/config/DumpConfiguration.d.ts +42 -0
- package/lib/types/config/DumpConfiguration.js +3 -0
- package/lib/types/config/HttpConfiguration.d.ts +43 -0
- package/lib/types/config/HttpConfiguration.js +9 -0
- package/lib/types/config/KuzzleConfiguration.d.ts +123 -0
- package/lib/types/config/KuzzleConfiguration.js +3 -0
- package/lib/types/config/LimitsConfiguration.d.ts +111 -0
- package/lib/types/config/LimitsConfiguration.js +3 -0
- package/lib/types/config/PluginsConfiguration.d.ts +177 -0
- package/lib/types/config/PluginsConfiguration.js +3 -0
- package/lib/types/config/SecurityConfiguration.d.ts +182 -0
- package/lib/types/config/SecurityConfiguration.js +3 -0
- package/lib/types/config/ServerConfiguration.d.ts +195 -0
- package/lib/types/config/ServerConfiguration.js +3 -0
- package/lib/types/config/ServicesConfiguration.d.ts +41 -0
- package/lib/types/config/ServicesConfiguration.js +3 -0
- package/lib/types/config/StorageService/StorageServiceElasticsearchConfiguration.d.ts +217 -0
- package/lib/types/config/StorageService/StorageServiceElasticsearchConfiguration.js +3 -0
- package/lib/types/config/internalCache/InternalCacheRedisConfiguration.d.ts +111 -0
- package/lib/types/config/internalCache/InternalCacheRedisConfiguration.js +3 -0
- package/lib/types/config/publicCache/PublicCacheRedisConfiguration.d.ts +31 -0
- package/lib/types/config/publicCache/PublicCacheRedisConfiguration.js +3 -0
- package/lib/types/index.d.ts +17 -0
- package/lib/types/index.js +17 -0
- package/package-lock.json +1 -1
- package/package.json +1 -1
package/lib/config/index.js
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
const assert = require('assert');
|
|
25
25
|
|
|
26
26
|
const rc = require('rc');
|
|
27
|
-
|
|
27
|
+
const defaultConfig = require('./default.config');
|
|
28
28
|
const packageJson = require('../../package.json');
|
|
29
29
|
const kerror = require('../kerror').wrap('core', 'configuration');
|
|
30
30
|
const { isPlainObject } = require('../util/safeObject');
|
|
@@ -34,11 +34,11 @@ const bytes = require('../util/bytes');
|
|
|
34
34
|
* Loads, interprets and checks configuration files
|
|
35
35
|
* @returns {object}
|
|
36
36
|
*/
|
|
37
|
-
function
|
|
37
|
+
function loadConfig () {
|
|
38
38
|
let config;
|
|
39
39
|
|
|
40
40
|
try {
|
|
41
|
-
config = rc('kuzzle',
|
|
41
|
+
config = rc('kuzzle', defaultConfig.default);
|
|
42
42
|
}
|
|
43
43
|
catch (e) {
|
|
44
44
|
throw kerror.get('cannot_parse', e.message);
|
|
@@ -128,10 +128,12 @@ function checkLimitsConfig (cfg) {
|
|
|
128
128
|
'requestsBufferSize',
|
|
129
129
|
'requestsBufferWarningThreshold',
|
|
130
130
|
'subscriptionConditionsCount',
|
|
131
|
+
'subscriptionMinterms',
|
|
131
132
|
'subscriptionRooms',
|
|
132
133
|
'subscriptionDocumentTTL'
|
|
133
134
|
];
|
|
134
135
|
const canBeZero = [
|
|
136
|
+
'subscriptionMinterms',
|
|
135
137
|
'subscriptionRooms',
|
|
136
138
|
'subscriptionDocumentTTL'
|
|
137
139
|
];
|
|
@@ -263,10 +265,10 @@ function preprocessProtocolsOptions(config) {
|
|
|
263
265
|
|
|
264
266
|
function preprocessRedisOptions (redisConfig) {
|
|
265
267
|
// @deprecated Remove those lines for Kuzzle v3 then
|
|
266
|
-
// remove also 'database' from .kuzzlerc.sample and default.config
|
|
268
|
+
// remove also 'database' from .kuzzlerc.sample and default.config
|
|
267
269
|
if (redisConfig.database) {
|
|
268
270
|
redisConfig.options = { db: redisConfig.database, ...redisConfig.options };
|
|
269
271
|
}
|
|
270
272
|
}
|
|
271
273
|
|
|
272
|
-
module.exports = {
|
|
274
|
+
module.exports = { loadConfig };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { JSONObject } from '../../../index';
|
|
2
1
|
import { ApplicationManager, Backend } from './index';
|
|
2
|
+
import { KuzzleConfiguration } from '../../types/config/KuzzleConfiguration';
|
|
3
3
|
export declare class BackendConfig extends ApplicationManager {
|
|
4
4
|
/**
|
|
5
5
|
* Configuration content
|
|
6
6
|
*/
|
|
7
|
-
content:
|
|
7
|
+
content: KuzzleConfiguration;
|
|
8
8
|
constructor(application: Backend);
|
|
9
9
|
/**
|
|
10
10
|
* Sets a configuration value
|
|
@@ -18,5 +18,5 @@ export declare class BackendConfig extends ApplicationManager {
|
|
|
18
18
|
*
|
|
19
19
|
* @param config - Configuration object to merge
|
|
20
20
|
*/
|
|
21
|
-
merge(config:
|
|
21
|
+
merge(config: KuzzleConfiguration): void;
|
|
22
22
|
}
|
|
@@ -26,13 +26,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.BackendConfig = void 0;
|
|
27
27
|
const lodash_1 = __importDefault(require("lodash"));
|
|
28
28
|
const kerror_1 = __importDefault(require("../../kerror"));
|
|
29
|
-
const config_1 = __importDefault(require("../../config"));
|
|
30
29
|
const index_1 = require("./index");
|
|
30
|
+
const index_js_1 = require("../../config/index.js");
|
|
31
31
|
const runtimeError = kerror_1.default.wrap('plugin', 'runtime');
|
|
32
32
|
class BackendConfig extends index_1.ApplicationManager {
|
|
33
33
|
constructor(application) {
|
|
34
34
|
super(application);
|
|
35
|
-
this.content =
|
|
35
|
+
this.content = (0, index_js_1.loadConfig)();
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Sets a configuration value
|
|
@@ -87,28 +87,28 @@ class Profile {
|
|
|
87
87
|
this.validateRateLimit();
|
|
88
88
|
|
|
89
89
|
if (!this.policies) {
|
|
90
|
-
throw assertionError.get('missing_argument',
|
|
90
|
+
throw assertionError.get('missing_argument', `${this._id}.policies`);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
if (!Array.isArray(this.policies)) {
|
|
94
|
-
throw assertionError.get('invalid_type',
|
|
94
|
+
throw assertionError.get('invalid_type', `${this._id}.policies`, 'object[]');
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
if (this.policies.length === 0) {
|
|
98
|
-
throw assertionError.get('empty_argument',
|
|
98
|
+
throw assertionError.get('empty_argument', `${this._id}.policies`);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
let i = 0;
|
|
102
102
|
for (const policy of this.policies) {
|
|
103
103
|
if (!policy.roleId) {
|
|
104
|
-
throw assertionError.get('missing_argument',
|
|
104
|
+
throw assertionError.get('missing_argument', `${this._id}.policies[${i}].roleId`);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
for (const member of Object.keys(policy)) {
|
|
108
108
|
if (member !== 'roleId' && member !== 'restrictedTo') {
|
|
109
109
|
throw assertionError.get(
|
|
110
110
|
'unexpected_argument',
|
|
111
|
-
|
|
111
|
+
`${this._id}.policies[${i}].${member}`,
|
|
112
112
|
'"roleId", "restrictedTo"');
|
|
113
113
|
}
|
|
114
114
|
}
|
|
@@ -117,7 +117,7 @@ class Profile {
|
|
|
117
117
|
if (!Array.isArray(policy.restrictedTo)) {
|
|
118
118
|
throw assertionError.get(
|
|
119
119
|
'invalid_type',
|
|
120
|
-
|
|
120
|
+
`${this._id}.policies[${i}].restrictedTo`,
|
|
121
121
|
'object[]');
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -126,14 +126,14 @@ class Profile {
|
|
|
126
126
|
if (!isPlainObject(restriction)) {
|
|
127
127
|
throw assertionError.get(
|
|
128
128
|
'invalid_type',
|
|
129
|
-
|
|
129
|
+
`${this._id}.policies[${i}].restrictedTo[${restriction}]`,
|
|
130
130
|
'object');
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
if (restriction.index === null || restriction.index === undefined) {
|
|
134
134
|
throw assertionError.get(
|
|
135
135
|
'missing_argument',
|
|
136
|
-
|
|
136
|
+
`${this._id}.policies[${i}].restrictedTo[${j}].index`);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
if (strict) {
|
|
@@ -156,7 +156,7 @@ class Profile {
|
|
|
156
156
|
if (!Array.isArray(restriction.collections)) {
|
|
157
157
|
throw assertionError.get(
|
|
158
158
|
'invalid_type',
|
|
159
|
-
|
|
159
|
+
`${this._id}.policies[${i}].restrictedTo[${j}].collections`,
|
|
160
160
|
'string[]');
|
|
161
161
|
}
|
|
162
162
|
|
|
@@ -188,7 +188,7 @@ class Profile {
|
|
|
188
188
|
if (member !== 'index' && member !== 'collections') {
|
|
189
189
|
throw assertionError.get(
|
|
190
190
|
'unexpected_argument',
|
|
191
|
-
|
|
191
|
+
`${this._id}.policies[${i}].restrictedTo[${j}].${member}`,
|
|
192
192
|
'"index", "collections"');
|
|
193
193
|
}
|
|
194
194
|
}
|
|
@@ -96,15 +96,15 @@ class Role {
|
|
|
96
96
|
*/
|
|
97
97
|
async validateDefinition () {
|
|
98
98
|
if (this.controllers === undefined || this.controllers === null) {
|
|
99
|
-
throw assertionError.get('missing_argument',
|
|
99
|
+
throw assertionError.get('missing_argument', `${this._id}.controllers`);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
if (!isPlainObject(this.controllers)) {
|
|
103
|
-
throw assertionError.get('invalid_type',
|
|
103
|
+
throw assertionError.get('invalid_type', `${this._id}.controllers`, 'object');
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
if (Object.keys(this.controllers).length === 0) {
|
|
107
|
-
throw assertionError.get('empty_argument',
|
|
107
|
+
throw assertionError.get('empty_argument', `${this._id}.controllers`);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
Object
|
|
@@ -43,6 +43,7 @@ class Redis extends Service {
|
|
|
43
43
|
this.client = null;
|
|
44
44
|
this.commands = {};
|
|
45
45
|
this.adapterName = name;
|
|
46
|
+
this.pingIntervalID = null;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
/**
|
|
@@ -80,6 +81,10 @@ class Redis extends Service {
|
|
|
80
81
|
});
|
|
81
82
|
|
|
82
83
|
this.setCommands();
|
|
84
|
+
// TODO: Remove this when IORedis does support application level pings to keep connection to Azure Redis alive
|
|
85
|
+
if (config.pingKeepAlive && config.pingKeepAlive > 0) {
|
|
86
|
+
this._setupKeepAlive(config.pingKeepAlive);
|
|
87
|
+
}
|
|
83
88
|
|
|
84
89
|
return new Bluebird((resolve, reject) => {
|
|
85
90
|
this.client.once('ready', async () => {
|
|
@@ -93,6 +98,34 @@ class Redis extends Service {
|
|
|
93
98
|
});
|
|
94
99
|
}
|
|
95
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Setup a ping interval to keep the connection alive
|
|
103
|
+
* Every 60 seconds a ping is sent to Redis
|
|
104
|
+
*/
|
|
105
|
+
_setupKeepAlive(delay) {
|
|
106
|
+
this.client.on('ready', async () => {
|
|
107
|
+
await this._ping();
|
|
108
|
+
this.pingIntervalID = setInterval(this._ping.bind(this), delay);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
this.client.on('error', () => {
|
|
112
|
+
clearInterval(this.pingIntervalID);
|
|
113
|
+
this.pingIntervalID = null;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Ping Redis
|
|
119
|
+
*/
|
|
120
|
+
async _ping() {
|
|
121
|
+
try {
|
|
122
|
+
await this.client.ping();
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
global.kuzzle.log.error(`Failed to PING Redis to keep connection alive:\n${error.message}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
96
129
|
/**
|
|
97
130
|
* Initializes the Redis commands list, and add transformers when necessary
|
|
98
131
|
*/
|
|
@@ -237,6 +237,12 @@ class ElasticSearch extends Service {
|
|
|
237
237
|
let size = 0;
|
|
238
238
|
|
|
239
239
|
for (const [indice, indiceInfo] of Object.entries(body.indices)) {
|
|
240
|
+
// Ignore non-Kuzzle indices
|
|
241
|
+
if ( indice[INDEX_PREFIX_POSITION_IN_INDICE] !== PRIVATE_PREFIX
|
|
242
|
+
&& indice[INDEX_PREFIX_POSITION_IN_INDICE] !== PUBLIC_PREFIX ) {
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
|
|
240
246
|
const alias = await this._getAliasFromIndice(indice);
|
|
241
247
|
const indexName = this._extractIndex(alias);
|
|
242
248
|
const collectionName = this._extractCollection(alias);
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a password policy of the local auth strategy plugin.
|
|
3
|
+
*
|
|
4
|
+
* @see https://docs.kuzzle.io/core/2/guides/main-concepts/authentication#password-policies
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* {
|
|
9
|
+
* "appliesTo": {
|
|
10
|
+
* "profiles": ["editor"],
|
|
11
|
+
* "roles": ["admin"]
|
|
12
|
+
* },
|
|
13
|
+
* "expiresAfter": "30d",
|
|
14
|
+
* "mustChangePasswordIfSetByAdmin": true,
|
|
15
|
+
* "passwordRegex": "^(?=.*[a-zA-Z])(?=.*[0-9])(?=.{8,})"
|
|
16
|
+
* }
|
|
17
|
+
*/
|
|
18
|
+
export declare type PasswordPolicy = {
|
|
19
|
+
/**
|
|
20
|
+
* Applies the policy to matching users.
|
|
21
|
+
*
|
|
22
|
+
* Can be either set to a wildcar (`"*""`) to match all users or to an
|
|
23
|
+
* object containing at least of the following property.
|
|
24
|
+
*/
|
|
25
|
+
appliesTo: '*' | {
|
|
26
|
+
/**
|
|
27
|
+
* Array of user kuids the policy applies to.
|
|
28
|
+
*/
|
|
29
|
+
users?: string[];
|
|
30
|
+
/**
|
|
31
|
+
* Array of profile ids the policy applies to.
|
|
32
|
+
*/
|
|
33
|
+
profiles?: string[];
|
|
34
|
+
/**
|
|
35
|
+
* Array of role ids the policy applies to.
|
|
36
|
+
*/
|
|
37
|
+
roles?: string[];
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* The delay after which a password expires.
|
|
41
|
+
*
|
|
42
|
+
* @see https://www.npmjs.com/package/ms
|
|
43
|
+
*
|
|
44
|
+
* Users with expired passwords are given a resetPasswordToken when logging in
|
|
45
|
+
* and must change their password to be allowed to log in again.
|
|
46
|
+
*/
|
|
47
|
+
expiresAfter: string;
|
|
48
|
+
/**
|
|
49
|
+
* If set to true, prevents users to use their username in part of the password.
|
|
50
|
+
*
|
|
51
|
+
* The check is case-insensitive.
|
|
52
|
+
*/
|
|
53
|
+
forbidLoginInPassword: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* The number of passwords to store in history and checked against
|
|
56
|
+
* when a new password is set to prevent passwords reuse.
|
|
57
|
+
*/
|
|
58
|
+
forbidReusedPasswordCount: number;
|
|
59
|
+
/**
|
|
60
|
+
* If set to true, whenever a password is set for a user by someone else,
|
|
61
|
+
* that user will receive a resetPasswordToken upon their next login and
|
|
62
|
+
* they will have to change their password before being allowed to log in again.
|
|
63
|
+
*/
|
|
64
|
+
mustChangePasswordIfSetByAdmin: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* A string representation of a regular expression to test on new passwords.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
*
|
|
70
|
+
* // must be at least 6 chars long
|
|
71
|
+
* ".{6,}"
|
|
72
|
+
*
|
|
73
|
+
* // must be at least 8 chars long and include at least one letter and one digit
|
|
74
|
+
* "^(?=.*[a-zA-Z])(?=.*[0-9])(?=.{8,})"
|
|
75
|
+
*/
|
|
76
|
+
passwordRegex: string;
|
|
77
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A profile definition.
|
|
3
|
+
*
|
|
4
|
+
* @see https://docs.kuzzle.io/core/2/guides/main-concepts/permissions/#profiles
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* {
|
|
9
|
+
* rateLimit: 200,
|
|
10
|
+
* policies: [
|
|
11
|
+
* {
|
|
12
|
+
* roleId: 'anonymous',
|
|
13
|
+
* restrictedTo: [ { index: 'device-manager' } ]
|
|
14
|
+
* }
|
|
15
|
+
* ]
|
|
16
|
+
* }
|
|
17
|
+
*/
|
|
18
|
+
export declare type ProfileDefinition = {
|
|
19
|
+
/**
|
|
20
|
+
* The rate limit parameter controls how many API requests a user can send,
|
|
21
|
+
* per second and per node.
|
|
22
|
+
*/
|
|
23
|
+
rateLimit: number;
|
|
24
|
+
/**
|
|
25
|
+
* Grant a role rights on API actions for this profile.
|
|
26
|
+
*
|
|
27
|
+
* Each role can be restricted to a list of indexes and collections.
|
|
28
|
+
*/
|
|
29
|
+
policies: Array<{
|
|
30
|
+
/**
|
|
31
|
+
* Role ID
|
|
32
|
+
*/
|
|
33
|
+
roleId: string;
|
|
34
|
+
/**
|
|
35
|
+
* List of indexes and collections to restrict this role on.
|
|
36
|
+
*/
|
|
37
|
+
restrictedTo?: Array<{
|
|
38
|
+
/**
|
|
39
|
+
* Index name.
|
|
40
|
+
*/
|
|
41
|
+
index: string;
|
|
42
|
+
/**
|
|
43
|
+
* Collection names.
|
|
44
|
+
*/
|
|
45
|
+
collections: string[];
|
|
46
|
+
}>;
|
|
47
|
+
}>;
|
|
48
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A role definition
|
|
3
|
+
*
|
|
4
|
+
* @see https://docs.kuzzle.io/core/2/guides/main-concepts/permissions/#roles
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* {
|
|
9
|
+
* controllers: {
|
|
10
|
+
* auth: {
|
|
11
|
+
* actions: {
|
|
12
|
+
* getCurrentUser: true,
|
|
13
|
+
* logout: true
|
|
14
|
+
* }
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
*/
|
|
19
|
+
export declare type RoleDefinition = {
|
|
20
|
+
controllers: {
|
|
21
|
+
[controllerName: string]: {
|
|
22
|
+
actions: {
|
|
23
|
+
[actionName: string]: boolean;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare type DumpConfiguration = {
|
|
2
|
+
/**
|
|
3
|
+
* @default false
|
|
4
|
+
*/
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
history: {
|
|
7
|
+
/**
|
|
8
|
+
* @default 3
|
|
9
|
+
*/
|
|
10
|
+
coredump: number;
|
|
11
|
+
/**
|
|
12
|
+
* @default 5
|
|
13
|
+
*/
|
|
14
|
+
reports: number;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* @default './dump/'
|
|
18
|
+
*/
|
|
19
|
+
path: string;
|
|
20
|
+
/**
|
|
21
|
+
* @default 'gcore'
|
|
22
|
+
*/
|
|
23
|
+
gcore: string;
|
|
24
|
+
/**
|
|
25
|
+
* @default 'YYYYMMDD-HHmmss'
|
|
26
|
+
*/
|
|
27
|
+
dateFormat: string;
|
|
28
|
+
handledErrors: {
|
|
29
|
+
/**
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* @default ['RangeError','TypeError','KuzzleError','InternalError'],
|
|
35
|
+
*/
|
|
36
|
+
whitelist: string[];
|
|
37
|
+
/**
|
|
38
|
+
* @default 600000
|
|
39
|
+
*/
|
|
40
|
+
minInterval: number;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* routes: list of Kuzzle API exposed HTTP routes
|
|
3
|
+
* accessControlAllowOrigin: sets the Access-Control-Allow-Origin header used to
|
|
4
|
+
* send responses to the client
|
|
5
|
+
* (see https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS)
|
|
6
|
+
*/
|
|
7
|
+
export declare type HttpConfiguration = {
|
|
8
|
+
routes: any;
|
|
9
|
+
/**
|
|
10
|
+
* Sets the default Access-Control-Allow-Origin HTTP
|
|
11
|
+
* header used to send responses to the client.
|
|
12
|
+
*
|
|
13
|
+
* @default "*"
|
|
14
|
+
*/
|
|
15
|
+
accessControlAllowOrigin: string;
|
|
16
|
+
/**
|
|
17
|
+
* Sets the default Access-Control-Allow-Origin HTTP
|
|
18
|
+
* header used to send responses to the client.
|
|
19
|
+
*
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
accessControlAllowOriginUseRegExp: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Sets the default Access-Control-Allow-Method header.
|
|
25
|
+
*
|
|
26
|
+
* @default "GET,POST,PUT,DELETE,OPTIONS,HEAD"
|
|
27
|
+
*/
|
|
28
|
+
accessControlAllowMethods: string;
|
|
29
|
+
/**
|
|
30
|
+
* Sets the default Access-Control-Allow-Headers.
|
|
31
|
+
*
|
|
32
|
+
* @default "Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With, Content-Encoding, Content-Length, X-Kuzzle-Volatile"
|
|
33
|
+
*/
|
|
34
|
+
accessControlAllowHeaders: string;
|
|
35
|
+
/**
|
|
36
|
+
* Allows browser clients to connect to Kuzzle with cookies.
|
|
37
|
+
* /!\ This should not be allowed if the "http.accessControlAllowOrigin"
|
|
38
|
+
* configuration contains a wildcard ("*").
|
|
39
|
+
*
|
|
40
|
+
* @default true
|
|
41
|
+
*/
|
|
42
|
+
cookieAuthentication: boolean;
|
|
43
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* routes: list of Kuzzle API exposed HTTP routes
|
|
4
|
+
* accessControlAllowOrigin: sets the Access-Control-Allow-Origin header used to
|
|
5
|
+
* send responses to the client
|
|
6
|
+
* (see https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS)
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
//# sourceMappingURL=HttpConfiguration.js.map
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { ServerConfiguration, ServicesConfiguration, SecurityConfiguration, HttpConfiguration, PluginsConfiguration, LimitsConfiguration, DumpConfiguration } from '../index';
|
|
2
|
+
export interface IKuzzleConfiguration {
|
|
3
|
+
realtime: {
|
|
4
|
+
/**
|
|
5
|
+
* @default false
|
|
6
|
+
*/
|
|
7
|
+
pcreSupport: boolean;
|
|
8
|
+
};
|
|
9
|
+
dump: DumpConfiguration;
|
|
10
|
+
/**
|
|
11
|
+
* The HTTP section lets you configure how Kuzzle should
|
|
12
|
+
* handle HTTP requests.
|
|
13
|
+
*/
|
|
14
|
+
http: HttpConfiguration;
|
|
15
|
+
/**
|
|
16
|
+
* Kuzzle configured limits.
|
|
17
|
+
*/
|
|
18
|
+
limits: LimitsConfiguration;
|
|
19
|
+
/**
|
|
20
|
+
* The application section lets you configure your application.
|
|
21
|
+
*/
|
|
22
|
+
application: Record<string, unknown>;
|
|
23
|
+
/**
|
|
24
|
+
* The plugins section lets you define plugins behaviors.
|
|
25
|
+
*
|
|
26
|
+
* @see https://docs.kuzzle.io/core/2/guides/write-plugins
|
|
27
|
+
*/
|
|
28
|
+
plugins: PluginsConfiguration;
|
|
29
|
+
/**
|
|
30
|
+
* The repositories are used internally by Kuzzle to store its data (users,
|
|
31
|
+
* permissions, configuration etc.)
|
|
32
|
+
*/
|
|
33
|
+
repositories: {
|
|
34
|
+
common: {
|
|
35
|
+
/**
|
|
36
|
+
* Time to live (in seconds) of cached objects.
|
|
37
|
+
*
|
|
38
|
+
* Decreasing this value will lower Redis memory and disk consumption,
|
|
39
|
+
* at the cost of increasing queries rate to the database and response times.
|
|
40
|
+
*
|
|
41
|
+
* @default 1440000
|
|
42
|
+
*/
|
|
43
|
+
cacheTTL: number;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* The security section contains the configuration for Kuzzle permissions
|
|
48
|
+
* system.
|
|
49
|
+
*
|
|
50
|
+
*/
|
|
51
|
+
security: SecurityConfiguration;
|
|
52
|
+
/**
|
|
53
|
+
* Kuzzle server is the entry point for incoming requests.
|
|
54
|
+
*/
|
|
55
|
+
server: ServerConfiguration;
|
|
56
|
+
/**
|
|
57
|
+
* Services are the external components Kuzzle relies on.
|
|
58
|
+
*/
|
|
59
|
+
services: ServicesConfiguration;
|
|
60
|
+
stats: {
|
|
61
|
+
/**
|
|
62
|
+
* @default true
|
|
63
|
+
*/
|
|
64
|
+
enabled: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* @default 3600
|
|
67
|
+
*/
|
|
68
|
+
ttl: number;
|
|
69
|
+
/**
|
|
70
|
+
* @default 10
|
|
71
|
+
*/
|
|
72
|
+
statsInterval: number;
|
|
73
|
+
};
|
|
74
|
+
cluster: {
|
|
75
|
+
/**
|
|
76
|
+
* @default 50
|
|
77
|
+
*/
|
|
78
|
+
activityDepth: number;
|
|
79
|
+
/**
|
|
80
|
+
* @default 2000
|
|
81
|
+
*/
|
|
82
|
+
heartbeat: number;
|
|
83
|
+
/**
|
|
84
|
+
* @default null
|
|
85
|
+
*/
|
|
86
|
+
interface: any;
|
|
87
|
+
/**
|
|
88
|
+
* @default false
|
|
89
|
+
*/
|
|
90
|
+
ipv6: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* @default 'private'
|
|
93
|
+
*/
|
|
94
|
+
ip: string;
|
|
95
|
+
/**
|
|
96
|
+
* @default 60000
|
|
97
|
+
*/
|
|
98
|
+
joinTimeout: number;
|
|
99
|
+
/**
|
|
100
|
+
* @default 1
|
|
101
|
+
*/
|
|
102
|
+
minimumNodes: number;
|
|
103
|
+
ports: {
|
|
104
|
+
/**
|
|
105
|
+
* @default 7510
|
|
106
|
+
*/
|
|
107
|
+
command: number;
|
|
108
|
+
/**
|
|
109
|
+
* @default 7511
|
|
110
|
+
*/
|
|
111
|
+
sync: number;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* @default 5000
|
|
115
|
+
*/
|
|
116
|
+
syncTimeout: number;
|
|
117
|
+
};
|
|
118
|
+
internal: {
|
|
119
|
+
hash: any;
|
|
120
|
+
};
|
|
121
|
+
validation: Record<string, unknown>;
|
|
122
|
+
}
|
|
123
|
+
export declare type KuzzleConfiguration = Partial<IKuzzleConfiguration>;
|