mirror of
https://github.com/dadosfera/maestro.git
synced 2026-08-31 19:58:21 +00:00
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { credentials } from '@grpc/grpc-js';
|
|
import {
|
|
ClientsProviderAsyncOptions,
|
|
GrpcOptions,
|
|
Transport,
|
|
} from '@nestjs/microservices';
|
|
import { ConnectionManager } from '@dadosfera/protospack-v2';
|
|
|
|
const isLocalConnection =
|
|
process.env.INFACTORY_URL.startsWith('in-factory:') ||
|
|
process.env.INFACTORY_URL.includes('0.0.0.0');
|
|
|
|
export class ConnectionClientConfiguration {
|
|
public name = 'ConnectionClientConfiguration';
|
|
private config: GrpcOptions = {
|
|
transport: Transport.GRPC,
|
|
options: {
|
|
url: process.env.INFACTORY_URL,
|
|
package: [
|
|
ConnectionManager.ProtoPackages.WritePackage,
|
|
ConnectionManager.ProtoPackages.ReadPackage,
|
|
],
|
|
credentials: isLocalConnection ? undefined : credentials.createSsl(),
|
|
protoPath: [
|
|
ConnectionManager.ProtoPaths.WriteFilePath,
|
|
ConnectionManager.ProtoPaths.ReadFilePath,
|
|
],
|
|
loader: {
|
|
keepCase: true,
|
|
enums: String,
|
|
objects: true,
|
|
arrays: true,
|
|
},
|
|
},
|
|
};
|
|
|
|
providerOptions: ClientsProviderAsyncOptions = {
|
|
name: this.name,
|
|
...this.config,
|
|
};
|
|
}
|