-
Notifications
You must be signed in to change notification settings - Fork 916
/
config.ts
64 lines (60 loc) · 2.02 KB
/
config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import { schema, TypeOf } from '@osd/config-schema';
import { fileAppenderSchema } from './audit_config';
const KEY_NAME_MIN_LENGTH: number = 1;
const KEY_NAME_MAX_LENGTH: number = 100;
// Wrapping key size should be 32 bytes, as used in envelope encryption algorithms.
const WRAPPING_KEY_SIZE: number = 32;
export const configSchema = schema.object({
enabled: schema.boolean({ defaultValue: false }),
hideLocalCluster: schema.boolean({ defaultValue: false }),
encryption: schema.object({
wrappingKeyName: schema.string({
minLength: KEY_NAME_MIN_LENGTH,
maxLength: KEY_NAME_MAX_LENGTH,
defaultValue: 'changeme',
}),
wrappingKeyNamespace: schema.string({
minLength: KEY_NAME_MIN_LENGTH,
maxLength: KEY_NAME_MAX_LENGTH,
defaultValue: 'changeme',
}),
wrappingKey: schema.arrayOf(schema.number(), {
minSize: WRAPPING_KEY_SIZE,
maxSize: WRAPPING_KEY_SIZE,
defaultValue: new Array(32).fill(0),
}),
}),
ssl: schema.object({
verificationMode: schema.oneOf(
[schema.literal('none'), schema.literal('certificate'), schema.literal('full')],
{ defaultValue: 'full' }
),
certificateAuthorities: schema.maybe(
schema.oneOf([schema.string(), schema.arrayOf(schema.string(), { minSize: 1 })])
),
}),
clientPool: schema.object({
size: schema.number({ defaultValue: 5 }),
}),
audit: schema.object({
enabled: schema.boolean({ defaultValue: false }),
appender: fileAppenderSchema,
}),
endpointDeniedIPs: schema.maybe(schema.arrayOf(schema.string())),
authTypes: schema.object({
NoAuthentication: schema.object({
enabled: schema.boolean({ defaultValue: true }),
}),
UsernamePassword: schema.object({
enabled: schema.boolean({ defaultValue: true }),
}),
AWSSigV4: schema.object({
enabled: schema.boolean({ defaultValue: true }),
}),
}),
});
export type DataSourcePluginConfigType = TypeOf<typeof configSchema>;