-
Notifications
You must be signed in to change notification settings - Fork 0
/
env.ts
30 lines (24 loc) · 983 Bytes
/
env.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
const env = Deno.env.toObject();
assertEnvironmentVariable("MATATAKI_API_PREFIX");
assertEnvironmentVariable("MATATAKI_COVER_PREFIX");
assertEnvironmentVariable("DB_HOST");
assertEnvironmentVariable("DB_USER");
assertEnvironmentVariable("DB_PASSWORD");
assertEnvironmentVariable("DB_DATABASE");
assertEnvironmentVariable("NATS_SERVER");
export const MATATAKI_API_PREFIX = env.MATATAKI_API_PREFIX;
export const MATATAKI_COVER_PREFIX = env.MATATAKI_COVER_PREFIX;
export const DB_HOST = env.DB_HOST;
export const DB_USER = env.DB_USER;
export const DB_PASSWORD = env.DB_PASSWORD;
export const DB_DATABASE = env.DB_DATABASE;
export const NATS_SERVER = env.NATS_SERVER;
export const REDIS_HOST = env.REDIS_HOST ?? "127.0.0.1";
export const REDIS_PORT = env.REDIS_PORT ?? 6379;
export const REDIS_PASSWORD = env.REDIS_PASSWORD;
function assertEnvironmentVariable(name: string) {
if (env[name])
return;
console.error(`Missing ${name} environment variable`);
Deno.exit(1);
}