Skip to content

Commit 48f31b9

Browse files
committed
feat: add development environment support for configuration management
1 parent b05e2a5 commit 48f31b9

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/env.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ function requireEnv(key: string): string {
1414
return value;
1515
}
1616

17+
function useDevEnv(key: string): string | undefined {
18+
const isDev = process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test';
19+
if (isDev) {
20+
return optionalEnv(key);
21+
}
22+
return undefined;
23+
}
24+
1725
// Single source of truth for all configuration
1826
export const config = {
1927
discord: {
@@ -33,6 +41,9 @@ export const config = {
3341
channelId: requireEnv('GUIDES_CHANNEL_ID'),
3442
trackerPath: optionalEnv('GUIDES_TRACKER_PATH'),
3543
},
44+
roleIds: {
45+
examleRole: useDevEnv('EXAMPLE_ROLE_ID') ?? '12345',
46+
},
3647
// Add more config sections as needed:
3748
// database: {
3849
// url: requireEnv('DATABASE_URL'),

0 commit comments

Comments
 (0)