mirror of
https://github.com/dadosfera/maestro.git
synced 2026-09-06 16:44:49 +00:00
35 lines
949 B
TypeScript
35 lines
949 B
TypeScript
import {
|
|
ClientProviderOptions,
|
|
GrpcOptions,
|
|
Transport,
|
|
} from '@nestjs/microservices';
|
|
import { credentials } from '@grpc/grpc-js';
|
|
import { Transformation } from '@dadosfera/protospack-v2';
|
|
|
|
const isLocalConnection =
|
|
process.env.INFACTORY_URL.startsWith('in-factory:') ||
|
|
process.env.INFACTORY_URL.includes('0.0.0.0');
|
|
|
|
export class TransformationsClientConfiguration {
|
|
public name = 'TransformationsClientConfiguration';
|
|
private config: GrpcOptions = {
|
|
transport: Transport.GRPC,
|
|
options: {
|
|
url: process.env.INFACTORY_URL,
|
|
package: [Transformation.ProtoPackages.WritePackage],
|
|
credentials: isLocalConnection ? undefined : credentials.createSsl(),
|
|
protoPath: [Transformation.ProtoPaths.WriteFilePath],
|
|
loader: {
|
|
enums: String,
|
|
objects: true,
|
|
arrays: true,
|
|
},
|
|
},
|
|
};
|
|
|
|
providerOptions: ClientProviderOptions = {
|
|
name: this.name,
|
|
...this.config,
|
|
};
|
|
}
|