Skip to content

Commit 6ba5b46

Browse files
committed
Use better-env config for luma cron calendar settings
1 parent 250bbe7 commit 6ba5b46

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

app/src/app/api/cron/luma-sync/route.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { NextResponse } from "next/server";
22
import { start } from "workflow/api";
3+
import { mainConfig } from "@/lib/config";
34
import { syncLumaEventsWorkflow } from "@/workflows/luma-sync";
45

56
export const runtime = "nodejs";
@@ -30,9 +31,9 @@ export async function GET(request: Request) {
3031
}
3132

3233
try {
33-
const calendarApiId = process.env.LUMA_CALENDAR_API_ID;
34+
const calendarApiId = mainConfig.luma.calendarApiId;
3435
const calendarHandle =
35-
process.env.LUMA_CALENDAR_HANDLE ?? DEFAULT_CALENDAR_HANDLE;
36+
mainConfig.luma.calendarHandle ?? DEFAULT_CALENDAR_HANDLE;
3637

3738
const run = await start(syncLumaEventsWorkflow, [
3839
{

app/src/lib/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ export const mainConfig = {
1818
},
1919
luma: {
2020
apiKey: integrationsConfig.lumaApiKey,
21+
calendarApiId: integrationsConfig.lumaCalendarApiId,
22+
calendarHandle: integrationsConfig.lumaCalendarHandle,
2123
},
2224
discord: {
2325
botToken: integrationsConfig.discordBotToken,

app/src/lib/integrations/config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ const integrationsEnvConfig = configSchema("Integrations", {
99
env: "LUMA_API_KEY",
1010
optional: true,
1111
}),
12+
lumaCalendarApiId: server({
13+
env: "LUMA_CALENDAR_API_ID",
14+
optional: true,
15+
}),
16+
lumaCalendarHandle: server({
17+
env: "LUMA_CALENDAR_HANDLE",
18+
optional: true,
19+
}),
1220
discordBotToken: server({
1321
env: "DISCORD_BOT_TOKEN",
1422
optional: true,
@@ -22,6 +30,8 @@ const integrationsEnvConfig = configSchema("Integrations", {
2230
export const integrationsConfig = {
2331
resendApiKey: integrationsEnvConfig.server.resendApiKey,
2432
lumaApiKey: integrationsEnvConfig.server.lumaApiKey,
33+
lumaCalendarApiId: integrationsEnvConfig.server.lumaCalendarApiId,
34+
lumaCalendarHandle: integrationsEnvConfig.server.lumaCalendarHandle,
2535
discordBotToken: integrationsEnvConfig.server.discordBotToken,
2636
discordReviewChannelId: integrationsEnvConfig.server.discordReviewChannelId,
2737
};

0 commit comments

Comments
 (0)