mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-05 10:24:05 +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:
@@ -1,4 +1,4 @@
|
||||
export { AppConfigModule } from './app-config.module';
|
||||
export { RuntimeEnvService } from './runtime-env.service';
|
||||
export { DataPathsService } from './data-paths.service';
|
||||
export { httpConfig, storageConfig, BOOT_STABLE_TOKENS } from './tokens';
|
||||
export { httpConfig, storageConfig, transitConfig, kitineraryConfig, BOOT_STABLE_TOKENS } from './tokens';
|
||||
|
||||
@@ -27,5 +27,9 @@ import { BOOT_DERIVERS } from '../../app-config/boot-derive';
|
||||
export const httpConfig = registerAs('http', () => BOOT_DERIVERS.http(process.env));
|
||||
/** The storage registry's conditional place-photo backend (TREK_PLACE_PHOTO_DIR). */
|
||||
export const storageConfig = registerAs('storage', () => BOOT_DERIVERS.storage(process.env));
|
||||
/** TransitService's upstream (TRANSIT_API_URL). */
|
||||
export const transitConfig = registerAs('transit', () => BOOT_DERIVERS.transit(process.env));
|
||||
/** KitineraryExtractorService's binary probe (KITINERARY_EXTRACTOR_PATH, then PATH). */
|
||||
export const kitineraryConfig = registerAs('kitinerary', () => BOOT_DERIVERS.kitinerary(process.env));
|
||||
|
||||
export const BOOT_STABLE_TOKENS = [httpConfig, storageConfig];
|
||||
export const BOOT_STABLE_TOKENS = [httpConfig, storageConfig, transitConfig, kitineraryConfig];
|
||||
|
||||
Reference in New Issue
Block a user