mirror of
https://github.com/dadosfera/maestro.git
synced 2026-09-30 23:59:09 +00:00
As part of our hybrid approach, we need to allow dataset cataloging from outside our cloud environment. Instead of relying on our GRPC APIs, we leveraged an existing REST API to handle this process. - Updated Maestro to call Nimbus directly for dataset registration. - Modified protospack to generate the necessary TypeScript interfaces. - Added the `/catalog/register-dataset` endpoint to the API. This change enables seamless dataset registration from external sources while maintaining compatibility with our existing infrastructure. Related tickets or issues: [TECN-9441]
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import {
|
|
ClientsProviderAsyncOptions,
|
|
GrpcOptions,
|
|
Transport,
|
|
} from '@nestjs/microservices';
|
|
import { credentials } from '@grpc/grpc-js';
|
|
import { Catalog } from '@dadosfera/protospack-v2';
|
|
import { PlatformInterfaces } from '@dadosfera/protospack-v2';
|
|
|
|
const isLocalConnection =
|
|
process.env.PIFACTORY_URL.startsWith('pi-factory:') ||
|
|
process.env.PIFACTORY_URL.includes('0.0.0.0');
|
|
|
|
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,
|
|
PlatformInterfaces.ProtoPackages.WritePackage
|
|
],
|
|
credentials: isLocalConnection ? undefined : credentials.createSsl(),
|
|
protoPath: [
|
|
Catalog.ProtoPaths.ReadFilePath,
|
|
Catalog.ProtoPaths.WriteFilePath,
|
|
PlatformInterfaces.ProtoPaths.WriteFilePath
|
|
],
|
|
loader: {
|
|
keepCase: true,
|
|
enums: String,
|
|
defaults: false,
|
|
},
|
|
},
|
|
};
|
|
providerOptions: ClientsProviderAsyncOptions = {
|
|
name: this.name,
|
|
...this.config,
|
|
};
|
|
}
|