From 0e204af330ef1d108aa0a86b2797b183fb4f419c Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Mon, 31 Mar 2025 20:37:53 -0700 Subject: [PATCH] for development and production, swap out in memory repo for redis one --- src/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index d1a1d14..de49b21 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,6 +10,7 @@ import { loadShuttleTestData } from "./loaders/loadShuttleTestData"; import { AppleNotificationSender } from "./notifications/senders/AppleNotificationSender"; import { InMemoryNotificationRepository } from "./repositories/InMemoryNotificationRepository"; import { NotificationRepository } from "./repositories/NotificationRepository"; +import { RedisNotificationRepository } from "./repositories/RedisNotificationRepository"; const typeDefs = readFileSync("./schema.graphqls", "utf8"); @@ -24,6 +25,7 @@ async function main() { let notificationRepository: NotificationRepository; let notificationService: ETANotificationScheduler; + if (process.argv.length > 2 && process.argv[2] == "integration-testing") { console.log("Using integration testing setup") await loadShuttleTestData(shuttleRepository); @@ -43,7 +45,10 @@ async function main() { ); await repositoryDataUpdater.start(); - notificationRepository = new InMemoryNotificationRepository(); + const redisNotificationRepository = new RedisNotificationRepository(); + await redisNotificationRepository.connect(); + + notificationRepository = redisNotificationRepository; notificationService = new ETANotificationScheduler( shuttleRepository, notificationRepository