feat: core chunk 8

This commit is contained in:
TrèsAbhi committed 2023-10-14 11:36:48 -05:00
1 parent 01dd7ad9c6
commit ec00bdf9de
14 files changed
+14 -14

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
import { config } from 'dotenv';
config();
export const SECRET_KEYS = [
'DISCORD_TOKEN',
'GH_TOKEN',
'DISCORD_BLITZ_DB',
] as const;
export type SECRET = typeof SECRET_KEYS extends readonly (infer T)[]
? T
: never;
export const secrets = SECRET_KEYS.reduce<Partial<Record<SECRET, string>>>(
(accumulator, key) => ({
...accumulator,
get [key](): string {
if (!(key in process.env)) throw new Error(`Secret ${key} not provided`);
return process.env[key]!;
},
}),
{},
) as Record<SECRET, string>;