Skip to content

[REQ][typescript-nestjs] Option for configuring via another provider like forRootAsync #15269

@omerd-cyera

Description

@omerd-cyera

Is your feature request related to a problem? Please describe.

I'm trying to use the typescript-nestjs client generator, and facing an issue when trying to configure the generated client with values from another provider.

Describe the solution you'd like

In most packages, the way to do it is with Module.forRootAsync as described here.
I think it would be very helpful if we could do something like this:

@Module({
  imports: [
    ApiModule.forRootAsync({
      import: [SettingsModue],
      inject: [SettingsServiceProvider],
      useFactory: (settingsService) => ({
        username: settingsService.username,
        password: settingsService.password,
        ...
      }),
    }),
  ],
})
export class AppModule {}

Describe alternatives you've considered

Currently I'm using the regular typescript client, and wrapping it in a nest provider manually. But i would like to move away from this solution if possible.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions