mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 19:19:52 +02:00
26 lines
539 B
TypeScript
26 lines
539 B
TypeScript
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>;
|