4.1.0 • Published 7 months ago

@qiwi/nestjs-enterprise-connection-provider v4.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

@qiwi/nestjs-enterprise-connection-provider

Nestjs module for getting endpoints from serviceProfile

Installation

Requires following packages to be installed

yarn add @qiwi/nestjs-enterprise-connection-provider

Configuration

Imports

import { Module } from '@nestjs/common'
import { ConnectionProviderModule } from '@qiwi/nestjs-enterprise-connection-provider'
import { LoggerModule } from '@qiwi/nestjs-enterprise-logger-nestjs'
import { ConsulModule } from '@qiwi/nestjs-enterprise-consul-nestjs'
import { ConfigModule } from '@qiwi/nestjs-enterprise-config-nestjs'

@Module({
  imports: [
    ConsulModule,
    ConnectionProviderModule,
    // and so on
  ],
  controllers: [],
  providers: [],
})
export class AppModule {}

Usage

@Injectable()
export class ThriftClientProvider implements IThriftClientProvider {
    constructor(
    @Inject('IConnectionProvider') private connectionProvider: IConnectionProvider,
    @Inject('IConfig') private config: IConfig
    ) {}

  private async createConnection(
    serviceProfile: IThriftServiceProfile | string,
  ): Promise<IConnectionParams> {
    const profile = serviceProfile ? this.config.get(serviceProfile) : serviceProfile
    const connectionParams = await this.connectionProvider.getConnectionParams(profile)
    //...etc
  }
}

API

Class ConnectionProviderModule

Exports IConnectionProvider with token IConnectionProviderService

Class ConnectionProviderService

getConnectionParams( serviceProfile: IServiceDeclaration ): Promise

Docs

3.0.0

9 months ago

4.1.0

7 months ago

4.0.1

8 months ago

4.0.0

8 months ago

4.0.3

8 months ago

4.0.2

8 months ago

2.0.5

11 months ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

2 years ago

1.1.1

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.1.0

2 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago