-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.ts
68 lines (64 loc) · 1.69 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
65
66
67
68
import path from "path";
import convict from "convict";
export interface Config {
readonly ip: string;
readonly port: number;
readonly filesPath: string;
readonly jwksUri: string;
readonly publishApiValidClients: string;
readonly filenamesInParallel: number;
readonly otelEnable: string;
readonly graphiqlEnable: boolean;
}
export const schema = convict<Config>({
ip: {
doc: "The IP address to bind.",
format: "ipaddress",
default: "0.0.0.0",
env: "IP_ADDRESS",
},
port: {
doc: "The port to bind.",
format: "port",
default: 4500,
env: "PORT",
},
filesPath: {
doc: "Where to store the published files.",
format: "String",
default: path.join(__dirname, "../../uploads/"),
env: "FILES_PATH",
},
jwksUri: {
doc: "Where to find keys used to verify JWT.",
format: "url",
default: "https://keycloak.promaster.se/auth/realms/promaster/protocol/openid-connect/certs",
env: "JWKS_URI",
},
publishApiValidClients: {
doc: "Comma separated list of allowed client_id's to access the publish endpoint",
format: "String",
default: "promaster-edit-backend",
env: "PUBLISH_API_VALID_CLIENTS",
},
filenamesInParallel: {
doc: "Files to read in parallel in publish middleware",
format: "int",
default: 50,
env: "READ_FILES_PARALLEL",
},
otelEnable: {
doc: "Controls if OpenTelemetry SDK is loaded",
format: ["true", "false"],
default: "false",
env: "OTEL_ENABLE",
},
graphiqlEnable: {
doc: "Controls if graphiql is enabled",
format: Boolean,
default: true,
env: "GRAPHIQL_ENABLE",
},
});
schema.validate({ allowed: "strict" });
export const config = schema.getProperties();