mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-28 07:30:04 +00:00
refactor(server): inject the transit base URL and the kitinerary paths as config tokens
The ownership rule says a boot-stable value that only Nest providers read belongs to a registerAs token, yet TransitService froze TRANSIT_API_URL in a module-top readEnv() const and KitineraryExtractorService read KITINERARY_EXTRACTOR_PATH and PATH through readEnv() in its probe. Both now come from tokens: transitConfig and kitineraryConfig, derived in boot-derive.ts and dropped from deriveIntegrations, so readEnv() no longer reads those variables at all. TransitModule and KitineraryExtractorModule import AppConfigModule, which keeps them buildable on their own in tests. Behaviour is unchanged: the same defaults, the same trailing-slash strip and PATH split, now frozen per built app instead of at import. The app-config README names each boot-stable variable that stays on readEnv() together with the reader the container cannot inject into.
This commit is contained in:
@@ -51,6 +51,7 @@ import { TodoService } from '../../src/nest/todo/todo.service';
|
||||
import { TransitMcp } from '../../src/nest/transit/transit.mcp';
|
||||
import { GoogleTransitProvider } from '../../src/nest/transit/google-transit.provider';
|
||||
import { TransitService } from '../../src/nest/transit/transit.service';
|
||||
import { transitConfig } from '../../src/nest/app-config/tokens';
|
||||
import { FilesService } from '../../src/nest/files/files.service';
|
||||
import { FilesMcp } from '../../src/nest/files/files.mcp';
|
||||
import { TripsMcp } from '../../src/nest/trips/trips.mcp';
|
||||
@@ -491,7 +492,7 @@ export async function createMcpTestRegistry(): Promise<McpRegistry> {
|
||||
// (`findUsernameEmail`, UM11's precedent) added in its place.
|
||||
usersRepo, authService, addonsService,
|
||||
),
|
||||
new TransitMcp(new TransitService(new GoogleTransitProvider(appSettings, usersRepo, noGoogleQuota)), daysService, reservationsService, await createTestTripsRepo(db), authService, guards),
|
||||
new TransitMcp(new TransitService(new GoogleTransitProvider(appSettings, usersRepo, noGoogleQuota), transitConfig()), daysService, reservationsService, await createTestTripsRepo(db), authService, guards),
|
||||
new AtlasMcp(new AtlasService(
|
||||
await createTestBucketListRepo(db), await createTestHiddenCountriesRepo(db),
|
||||
await createTestHiddenRegionsRepo(db), await createTestVisitedCountriesRepo(db),
|
||||
|
||||
Reference in New Issue
Block a user