Skip to content

Commit 384f686

Browse files
feat(config): Add QBO configuration and schema validation (#72)
- Introduced a new `qbo.ts` file containing the QBO API configuration and schema validation using Zod. - Updated the main configuration file to include the QBO schema in the validation process. These changes enhance the application's configuration management by integrating QBO API settings, ensuring proper validation of required environment variables.
1 parent b0a4fb0 commit 384f686

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

workers/main/.env.test

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ MONGO_DB_PASSWORD=testpassword
99
MONGO_DB_NAME=testdb
1010

1111
SLACK_TOKEN=test-token
12-
SLACK_FIN_REPORT_CHANNEL_ID=C02URP5L3U5
12+
SLACK_FIN_REPORT_CHANNEL_ID=C02URP5L3U5
13+
14+
QBO_API_URL=https://quickbooks.api.intuit.com/v3/company/111111111
15+
QBO_BEARER_TOKEN=test-token

workers/main/src/configs/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { mongoDatabaseSchema } from './mongoDatabase';
2+
import { qboSchema } from './qbo';
23
import { redmineDatabaseSchema } from './redmineDatabase';
34
import { slackSchema } from './slack';
45
import { temporalSchema } from './temporal';
@@ -9,4 +10,5 @@ export const validationResult = temporalSchema
910
.merge(slackSchema)
1011
.merge(redmineDatabaseSchema)
1112
.merge(mongoDatabaseSchema)
13+
.merge(qboSchema)
1214
.safeParse(process.env);

workers/main/src/configs/qbo.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 qboConfig = {
4+
apiUrl: process.env.QBO_API_URL,
5+
bearerToken: process.env.QBO_BEARER_TOKEN,
6+
};
7+
8+
export const qboSchema = z.object({
9+
QBO_API_URL: z.string().url(),
10+
QBO_BEARER_TOKEN: z.string(),
11+
});

0 commit comments

Comments
 (0)