-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathenv.ts
More file actions
108 lines (95 loc) · 2.17 KB
/
env.ts
File metadata and controls
108 lines (95 loc) · 2.17 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* eslint-disable sort-keys */
import env from "@fastify/env";
declare module "fastify" {
export interface FastifyInstance {
config: {
PORT: number;
HOST: string;
USER: string;
CLP_DB_USER: string;
CLP_DB_PASS: string;
CLP_STREAM_OUTPUT_AWS_ACCESS_KEY_ID: string;
CLP_STREAM_OUTPUT_AWS_SECRET_ACCESS_KEY: string;
PRESTO_CATALOG: string;
PRESTO_SCHEMA: string;
RATE_LIMIT: number;
};
}
}
const schema = {
type: "object",
required: [
"PORT",
"HOST",
"CLP_DB_USER",
"CLP_DB_PASS",
],
properties: {
// Network
PORT: {
type: "number",
default: 3000,
minimum: 1,
maximum: 65535,
},
HOST: {
type: "string",
minLength: 1,
default: "localhost",
},
// System
USER: {
type: "string",
default: "clp-webui",
},
// Databases
CLP_DB_USER: {
type: "string",
minLength: 1,
default: "clp-user",
},
CLP_DB_PASS: {
type: "string",
},
// S3
CLP_STREAM_OUTPUT_AWS_ACCESS_KEY_ID: {
type: "string",
default: "",
},
CLP_STREAM_OUTPUT_AWS_SECRET_ACCESS_KEY: {
type: "string",
default: "",
},
// Presto
PRESTO_CATALOG: {
type: "string",
default: "clp",
},
PRESTO_SCHEMA: {
type: "string",
default: "default",
},
// Security
RATE_LIMIT: {
type: "number",
default: 1_000,
minimum: 1,
},
},
};
export const autoConfig = {
confKey: "config",
schema: schema,
// Needed to read .env in root folder
dotenv: {
path: [
".env",
".env.local",
],
override: true,
},
// Source for the configuration data
// Optional, default: process.env
data: process.env,
};
export default env;