Skip to content

Commit

Permalink
✨ Added config file to manage config keys
Browse files Browse the repository at this point in the history
  • Loading branch information
ICEatm committed Jun 13, 2024
1 parent 21edb86 commit 5c2c0f6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
20 changes: 20 additions & 0 deletions config/config-keys.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Enum containing keys for configuration values related to paths.
*/
export const enum ConfigKeys {
/**
* Key for the logs path configuration.
*/
LOGS_PATH = 'default.paths.logsPath',
}

/**
* Enum containing keys for configuration values related to messages.
*/
export const enum MessageKeys {
/**
* Key for the welcome message configuration.
*/
INDEX_WELCOME = 'default.messages.indexWelcome',
}

3 changes: 2 additions & 1 deletion src/modules/index/index.service.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { MessageKeys } from '@config/config-keys.config';
import { ConfigService } from '@nestjs/config';
import { Injectable } from '@nestjs/common';

Expand All @@ -8,7 +9,7 @@ export class IndexService {
getIndex() {
return {
success: true,
message: this.configService.get('default.messages.indexWelcome'),
message: this.configService.get(MessageKeys.INDEX_WELCOME),
};
}
}

0 comments on commit 5c2c0f6

Please sign in to comment.