feat: add config
This commit is contained in:
@@ -0,0 +1,35 @@
|
|||||||
|
export interface Config {
|
||||||
|
token: string;
|
||||||
|
client_id: string;
|
||||||
|
owner_id: string | undefined;
|
||||||
|
|
||||||
|
tts_default_mode: string | undefined;
|
||||||
|
tts_default_voice: string | undefined;
|
||||||
|
|
||||||
|
tts_azure_key: string | undefined;
|
||||||
|
tts_elevenlabs_key: string | undefined;
|
||||||
|
|
||||||
|
steam_webapi_key: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadConfig(): Config {
|
||||||
|
const token = process.env.DISCORD_TOKEN;
|
||||||
|
const client_id = process.env.DISCORD_ID;
|
||||||
|
|
||||||
|
if (!token) throw new Error('DISCORD_TOKEN environment variable is not set.');
|
||||||
|
if (!client_id)
|
||||||
|
throw new Error('DISCORD_ID environment variable is not set.');
|
||||||
|
|
||||||
|
return {
|
||||||
|
token,
|
||||||
|
client_id,
|
||||||
|
owner_id: process.env.DISCORD_OWNER_ID,
|
||||||
|
tts_default_mode: process.env.DEFAULT_TTS_MODE,
|
||||||
|
tts_default_voice: process.env.DEFAULT_TTS_VOICE,
|
||||||
|
tts_azure_key: process.env.TTS_AZURE_KEY,
|
||||||
|
tts_elevenlabs_key: process.env.TTS_ELEVENLABS_KEY,
|
||||||
|
steam_webapi_key: process.env.STEAM_WEBAPI_KEY
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const config = loadConfig();
|
||||||
Reference in New Issue
Block a user