forked from dutu/bisq-watcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.config.schema.mjs
92 lines (90 loc) · 3.06 KB
/
app.config.schema.mjs
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/**
* @description This module defines the JSON schema for validating the main application configuration.
*
* @typedef {Object} configSchema
* @property {Object} type - Specifies that the configuration should be an object.
* @property {Object} properties - Defines the properties of the configuration.
* @property {Object} properties.name - The name of the watcher.
* @property {Object} properties.logFile - The location of the Bisq log file for the watcher.
* @property {Object} properties.transports - The configuration for the array of transport objects.
* At least one transport object must be defined.
* @property {Object} properties.debug - The debug configurations for the watcher.
* @property {Object} properties.overwriteRules - The configuration for the array of overwrite rules.
* @property {Array} required - An array specifying which properties are required.
*/
const configSchema = {
type: 'object',
properties: {
name: { type: 'string' },
logFile: { type: 'string' },
transports: {
type: 'array',
minItems: 1,
items: {
type: 'object',
properties: {
type: { enum: ['console', 'telegram', 'file'] },
apiToken: { type: 'string' },
chatIds: {
type: 'array',
items: { type: 'string' }
},
file: { type: 'string' },
timestamp: {
type: ['boolean', 'string']
},
maxLevel: { enum: ['crit', 'alert', 'error', 'warning', 'notice', 'info', 'debug'] },
disabled: { type: 'boolean' },
overwriteRules: {
type: 'array',
items: {
type: 'object',
properties: {
eventName: { type: 'string' },
message: { type: 'string' },
level: { enum: ['crit', 'alert', 'error', 'warning', 'info', 'notice', 'debug'] },
sendToTelegram: { type: 'boolean' },
activation: { enum: ['active', 'inactive'] }
},
required: ['eventName']
}
}
}
},
allOf: [
{
if: { properties: { type: { enum: ['telegram'] } } },
then: { required: ['apiToken', 'chatIds'] }
},
{
if: { properties: { type: { enum: ['file'] } } },
then: { required: ['file'] }
}
]
},
debug: {
type: 'object',
properties: {
atStartBuildEventCacheOnly: { type: 'boolean' },
overlappingGoBackNPositions: { type: 'number' },
useHash: { type: 'boolean' }
}
},
overwriteRules: {
type: 'array',
items: {
type: 'object',
properties: {
eventName: { type: 'string' },
message: { type: 'string' },
level: { enum: ['crit', 'alert', 'error', 'warning', 'info', 'notice', 'debug'] },
sendToTelegram: { type: 'boolean' },
activation: { enum: ['active', 'inactive'] }
},
required: ['eventName']
}
}
},
required: ['logFile', 'transports']
}
export default configSchema