mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 11:17:05 +02:00
feat: core chunk 8
This commit is contained in:
1 parent
01dd7ad9c6
commit
ec00bdf9de
14 files changed
+14
-14
No files matched your search
@@ -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>;
|
||||
Reference in new issue
Block a user