#Provide module options via providers

2 messages · Page 1 of 1 (latest)

median willow
#

I want to create a module that would be hosted in the root module, and each other module might, or might not, register some options for it - the goal is to not reference those module from the original, and have it dynamically discover such list of options.
Something like:

@Module({
  providers: [
    {
      provide: "AMQP_FEATURE_OPTIONS",
      useValue: "<some partial AMQP options needed only for A to run>"
    }
  ]
})
class FeatureA {}

@Module({
  providers: [
    {
      provide: "AMQP_FEATURE_OPTIONS",
      useValue: "<some partial AMQP options needed only for B to run>"
    }
  ]
})
class FeatureB {}

@Module({
  imports: [
    AMQP.forRoot("<some root AMQP options>"),
    FeatureA,
    FeatureB,
  ]
})
class AppModule {}
slim rainBOT
#

We have generated a response to your question, but it is too long to be sent as a single message. Please check the response attached as a file.