mirror of
https://github.com/dadosfera/maestro.git
synced 2026-10-09 05:29:08 +00:00
39 lines
975 B
TypeScript
39 lines
975 B
TypeScript
import {
|
|
ClientsProviderAsyncOptions,
|
|
GrpcOptions,
|
|
Transport,
|
|
} from '@nestjs/microservices';
|
|
import { credentials } from '@grpc/grpc-js';
|
|
import { Catalog } from '@dadosfera/protospack-v2';
|
|
|
|
export class CatalogClientConfiguration {
|
|
public name = 'CatalogClientConfiguration';
|
|
private config: GrpcOptions = {
|
|
transport: Transport.GRPC,
|
|
options: {
|
|
url: process.env.PIFACTORY_URL,
|
|
package: [
|
|
Catalog.ProtoPackages.ReadPackage,
|
|
Catalog.ProtoPackages.WritePackage,
|
|
],
|
|
credentials:
|
|
process.env.LOCAL_ENV || process.env.ENV === 'local'
|
|
? undefined
|
|
: credentials.createSsl(),
|
|
protoPath: [
|
|
Catalog.ProtoPaths.ReadFilePath,
|
|
Catalog.ProtoPaths.WriteFilePath,
|
|
],
|
|
loader: {
|
|
keepCase: true,
|
|
enums: String,
|
|
defaults: false,
|
|
},
|
|
},
|
|
};
|
|
providerOptions: ClientsProviderAsyncOptions = {
|
|
name: this.name,
|
|
...this.config,
|
|
};
|
|
}
|