Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
omerd-cyera opened this issue Apr 20, 2023 · 0 comments · Fixed by #16112
Closed

Comments

@omerd-cyera
Copy link

omerd-cyera commented Apr 20, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant