mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
22 lines
499 B
TypeScript
22 lines
499 B
TypeScript
export const SECRET_KEYS = [
|
|
'DISCORD_TOKEN',
|
|
'WARGAMING_APPLICATION_ID',
|
|
'GH_TOKEN',
|
|
] 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(`Key ${key} not provided`);
|
|
return process.env[key]!;
|
|
},
|
|
}),
|
|
{},
|
|
) as Record<SECRET, string>;
|