import { ClientsProviderAsyncOptions, GrpcOptions, Transport, } from '@nestjs/microservices'; import { PipelinePackages, PipelineProtoFilePath } from '@dadosfera/protospack'; import { credentials } from '@grpc/grpc-js'; const isLocalConnection = process.env.PIFACTORY_URL.startsWith('pi-factory:') || process.env.PIFACTORY_URL.includes('0.0.0.0'); export class PipelinesClientConfiguration { public name = 'PipelinesClientConfiguration'; private config: GrpcOptions = { transport: Transport.GRPC, options: { url: process.env.PIFACTORY_URL, package: PipelinePackages, credentials: isLocalConnection ? undefined : credentials.createSsl(), protoPath: PipelineProtoFilePath, loader: { keepCase: true, enums: String, defaults: false, }, }, }; providerOptions: ClientsProviderAsyncOptions = { name: this.name, ...this.config, }; }