Closed bneigher closed 1 year ago
I didn't quite understand the question, but I have provided a codesandbox and a few suggestions:
ServiceModule.registerAsync
works fine, and Config
does not resolve to undefined. This part of the problem has not been reproduced. Please provide further details with codesandbox if you have additional questions.
I'm submitting a...
Desired behavior
This might be a general nestjs question, but I figured I would ask here as this is probably a use case others may have. Basically, I am developing an App -> Lib relationship with strict config checking (to prevent developers missing setting an environment variable).
The requirement here is that the App needs to fetch a bunch of variables from external source (AWS Secret Manager). This works fine and the Config is type checked after loading. However, I have a library that depends on some of the configs (a subset). I want there to be validation on the library's module as well. But I can't figure out how to get the library to only load after the App has loaded.. I'm getting undefined values for my config values within the library getting booted up. See illustration below:
AppModule
and then in my lib (ServiceModule):
How can I change this to work as desired?
What is the motivation / use case for changing the behavior?
Illustration of developing libraries that share configs from a parent app, enforcing the same checks and informing developers which configs are needed from parent.
Environment