UNPKG

nestjs-eureka

Version:

A NestJS module that integrate eureka-js-client

30 lines 1.45 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.discoveryProviders = void 0; const discovery_service_1 = require("./discovery.service"); const discovery_interceptor_1 = require("./discovery.interceptor"); const client_provider_1 = require("../client/client.provider"); const eureka_js_client_1 = require("eureka-js-client"); const axios_1 = require("@nestjs/axios"); const discoveryServiceProvider = { provide: discovery_service_1.DiscoveryService, useFactory: (client, options) => { if (!options || !client || options.disable || options.disableDiscovery) { return undefined; } return new discovery_service_1.DiscoveryService(client); }, inject: [eureka_js_client_1.Eureka, client_provider_1.EUREKA_MODULE_OPTIONS], }; const discoveryInterceptorProvider = { provide: discovery_interceptor_1.DiscoveryInterceptor, useFactory: (httpService, discoveryService, options) => { if (!options || !httpService || options.disable || options.disableDiscovery) { return undefined; } return new discovery_interceptor_1.DiscoveryInterceptor(httpService, discoveryService); }, inject: [axios_1.HttpService, discovery_service_1.DiscoveryService, client_provider_1.EUREKA_MODULE_OPTIONS], }; exports.discoveryProviders = [discoveryServiceProvider, discoveryInterceptorProvider]; //# sourceMappingURL=discovery.provider.js.map