-
Notifications
You must be signed in to change notification settings - Fork 0
/
.settingsschema.js
93 lines (90 loc) · 1.85 KB
/
.settingsschema.js
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
93
const SimpleSchema = require('simpl-schema')
const oauthFlows = ['authorization_code']
const schema = def => new SimpleSchema(def)
const urlField = {
type: String,
regEx: SimpleSchema.RegEx.url
}
const settingsSchema = schema({
cors: Boolean,
jwt: schema({
key: String
}),
oauth: schema({
clientId: String,
secret: String,
dialogUrl: urlField,
accessTokenUrl: urlField,
authorizeUrl: urlField,
identityUrl: urlField,
redirectUrl: urlField
}),
hashing: schema({
algorithm: String,
digest: String
}),
hosts: schema({
otulea: schema({
url: urlField,
sub: String
}),
backend: schema({
url: urlField,
urlRegEx: schema({
regex: String
})
}),
teacher: schema({
url: urlField,
secret: String,
expires: SimpleSchema.Integer,
sub: String
}),
appbackend: schema({
url: urlField,
sub: String
})
}),
files: schema({
bucketName: String,
maxSize: SimpleSchema.Integer
}),
tts: schema({
maxChars: SimpleSchema.Integer,
allowedOrigins: Array,
'allowedOrigins.$': urlField
}),
competencies: schema({
url: String
}),
patches: schema({
clozeScoringSchema: Boolean,
recomputeProgress: Boolean,
linkAlphaLevel: Boolean
}),
status: schema({
active: Boolean,
interval: SimpleSchema.Integer,
secret: String,
url: urlField
}),
email: schema({
appName: String,
from: String,
notify: [String],
replyTo: String
}),
rateLimit: schema({
methods: schema({
get: [SimpleSchema.Integer],
all: [SimpleSchema.Integer],
insert: [SimpleSchema.Integer],
update: [SimpleSchema.Integer],
remove: [SimpleSchema.Integer],
})
}),
public: Object
})
module.exports = function (settings) {
settingsSchema.validate(settings)
}