UNPKG

@tdi-mc/elastic

Version:
48 lines 2.11 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ElasticConfig = void 0; const core_1 = require("@tdi-mc/core"); const http_1 = require("@tdi-mc/http"); const merge_deep_1 = __importDefault(require("merge-deep")); class ElasticConfig extends http_1.HttpConfig { constructor(props) { super(props); (0, merge_deep_1.default)(this, props, { protocol: props?.protocol || 'http', host: props?.host || 'localhost', port: (0, core_1.toInt)(props?.port, 9200), }); if (!this.baseURL) { this.baseURL = `${props.protocol}://${props.host}:${props.port}`; } } } exports.ElasticConfig = ElasticConfig; __decorate([ (0, core_1.IsOptional)(), (0, core_1.IsString)(), __metadata("design:type", String) ], ElasticConfig.prototype, "protocol", void 0); __decorate([ (0, core_1.IsOptional)(), (0, core_1.IsString)(), __metadata("design:type", String) ], ElasticConfig.prototype, "host", void 0); __decorate([ (0, core_1.IsOptional)(), (0, core_1.IsInt)(), __metadata("design:type", Number) ], ElasticConfig.prototype, "port", void 0); //# sourceMappingURL=elastic.config.js.map