aboutsummaryrefslogtreecommitdiff
path: root/src/server/Session/session_config_schema.ts
blob: e32cf8c6a653bfaf8c9ff9de7afccf8b0da1f310 (plain)
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
import { Schema } from "jsonschema";

const colorPattern = /black|red|green|yellow|blue|magenta|cyan|white|gray|grey/;

const identifierProperties: Schema = {
    type: "object",
    properties: {
        text: {
            type: "string",
            minLength: 1
        },
        color: {
            type: "string",
            pattern: colorPattern
        }
    }
};

const portProperties: Schema = {
    type: "number",
    minimum: 1024,
    maximum: 65535
};

export const configurationSchema: Schema = {
    id: "/configuration",
    type: "object",
    properties: {
        showServerOutput: { type: "boolean" },
        ports: {
            type: "object",
            properties: {
                server: portProperties,
                socket: portProperties
            },
            required: ["server"],
            additionalProperties: true
        },
        identifiers: {
            type: "object",
            properties: {
                master: identifierProperties,
                worker: identifierProperties,
                exec: identifierProperties
            }
        },
        polling: {
            type: "object",
            additionalProperties: false,
            properties: {
                intervalSeconds: {
                    type: "number",
                    minimum: 1,
                    maximum: 86400
                },
                route: {
                    type: "string",
                    pattern: /\/[a-zA-Z]*/g
                },
                failureTolerance: {
                    type: "number",
                    minimum: 0,
                }
            }
        },
    }
};