Conditionally import `HasuraModule` based on value from `ConfigService`
See original GitHub issueHello.
The documentation regarding Automatic Hasura Metadata Synchronization states that:
It is recommended that you conditionally add this configuration based on the Node Environment as this should only be used in development environments
It is quite trivial to do so with process.env.NODE_ENV
, since it is available outside of the Dependency Injection framework, but what if we wanted to set the condition based on the value from Nest’s ConfigService
, which is available from within the DI? I know that if we use HasuraModule.forRootAsync
, we would be able to configure the module using the injected config service, but I can’t seem to find a similar factory method that would allow me to exclude the HasuraModule
from the imports
array of the @Module
annotation.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
The HasuraModule provides the necessary components to actually receive event payloads from Hasura and then route them to the correct service so that they can be handled by your custom business logic. If you do not include the HasuraModule in your imports then you will not be able to process events.
The section you linked in your original comment from the docs is referring specifically to the
managedMetaDataConfig
portion of the module configuration. You should only include this property in development mode so that the module can help keep your local metadata files up to date.No problem, glad I was able to help out 😃