diff options
| author | Sam Wilkins <samwilkins333@gmail.com> | 2020-01-04 11:12:45 -0800 |
|---|---|---|
| committer | Sam Wilkins <samwilkins333@gmail.com> | 2020-01-04 11:12:45 -0800 |
| commit | 19b62446a1f05048c6fa940ea4cd7a94021d4ab1 (patch) | |
| tree | 629f8eefd3af2f9c4bf51fcf4749452f32150ecb /src/server/Session/session_config_schema.ts | |
| parent | 9a3df8031b55a16ad55cef6975ff8bf4f681f14e (diff) | |
cleaner refactor, improved use of configuration
Diffstat (limited to 'src/server/Session/session_config_schema.ts')
| -rw-r--r-- | src/server/Session/session_config_schema.ts | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/src/server/Session/session_config_schema.ts b/src/server/Session/session_config_schema.ts index 25d95c243..a5010055a 100644 --- a/src/server/Session/session_config_schema.ts +++ b/src/server/Session/session_config_schema.ts @@ -1,25 +1,31 @@ import { Schema } from "jsonschema"; -export const configurationSchema: Schema = { - id: "/Configuration", - type: "object", - properties: { - recipients: { - type: "array", - items: { - type: "string", - pattern: /[^\@]+\@[^\@]+/g - }, - minLength: 1 - }, - heartbeat: { +const emailPattern = /^(([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+)?$/g; +const localPortPattern = /http\:\/\/localhost:\d+\/[a-zA-Z]+/g; + +const properties = { + recipients: { + type: "array", + items: { type: "string", - pattern: /http\:\/\/localhost:\d+\/[a-zA-Z]+/g + pattern: emailPattern }, - signature: { type: "string" }, - masterIdentifier: { type: "string", minLength: 1 }, - workerIdentifier: { type: "string", minLength: 1 }, - silentChildren: { type: "boolean" } + minLength: 1 }, - required: ["heartbeat", "recipients", "signature", "masterIdentifier", "workerIdentifier", "silentChildren"] + heartbeat: { + type: "string", + pattern: localPortPattern + }, + signature: { type: "string" }, + masterIdentifier: { type: "string", minLength: 1 }, + workerIdentifier: { type: "string", minLength: 1 }, + showServerOutput: { type: "boolean" }, + pollingIntervalSeconds: { type: "number", minimum: 1, maximum: 86400 } +}; + +export const configurationSchema: Schema = { + id: "/configuration", + type: "object", + properties, + required: Object.keys(properties) };
\ No newline at end of file |
