Skip to content

Commit 2bd1d2f

Browse files
feat: Add MongoDB and Slack configuration schemas for validation
- Introduced `mongoDatabase.ts` and `slack.ts` files containing configuration schemas for MongoDB and Slack integration. - Updated `index.ts` to include the new schemas in the validation process. These changes enhance the environment validation by incorporating MongoDB and Slack configurations, ensuring proper setup for integration.
1 parent c80f36d commit 2bd1d2f

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

workers/main/src/configs/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
import { mongoDatabaseSchema } from './mongoDatabase';
12
import { redmineDatabaseSchema } from './redmineDatabase';
3+
import { slackSchema } from './slack';
24
import { temporalSchema } from './temporal';
35
import { workerSchema } from './worker';
46

57
export const validationResult = temporalSchema
68
.merge(workerSchema)
9+
.merge(slackSchema)
710
.merge(redmineDatabaseSchema)
11+
.merge(mongoDatabaseSchema)
812
.safeParse(process.env);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { z } from 'zod';
2+
3+
export const mongoDatabaseConfig = {
4+
host: process.env.MONGO_DB_HOST,
5+
user: process.env.MONGO_DB_USER,
6+
password: process.env.MONGO_DB_PASSWORD,
7+
database: process.env.MONGO_DB_NAME,
8+
};
9+
10+
export const mongoDatabaseSchema = z.object({
11+
MONGO_DB_HOST: z.string(),
12+
MONGO_DB_USER: z.string(),
13+
MONGO_DB_PASSWORD: z.string(),
14+
MONGO_DB_NAME: z.string(),
15+
});

workers/main/src/configs/slack.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { z } from 'zod';
2+
3+
export const slackConfig = {
4+
token: String(process.env.SLACK_TOKEN),
5+
channelId: String(process.env.SLACK_FIN_REPORT_CHANNEL_ID),
6+
};
7+
8+
export const slackSchema = z.object({
9+
SLACK_TOKEN: z.string(),
10+
SLACK_FIN_REPORT_CHANNEL_ID: z.string(),
11+
});

0 commit comments

Comments
 (0)