mirror of
https://github.com/dadosfera/maestro.git
synced 2026-08-31 19:58:21 +00:00
34 lines
928 B
TypeScript
34 lines
928 B
TypeScript
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,
|
|
};
|
|
}
|