UNPKG

@mdf.js/service-registry

Version:

MMS - API - Service Registry

100 lines 4.2 kB
"use strict"; /** * Copyright 2024 Mytra Control S.L. All rights reserved. * * Use of this source code is governed by an MIT-style license that can be found in the LICENSE file * or at https://opensource.org/licenses/MIT. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.DEFAULT_SERVICE_REGISTRY_OPTIONS = exports.DEFAULT_SERVICE_REGISTRY_CONFIG_CONFIG_LOADER_OPTIONS = exports.DEFAULT_CUSTOM_CONFIG_LOADER_OPTIONS = exports.DEFAULT_LOGGER_OPTIONS = exports.DEFAULT_OBSERVABILITY_OPTIONS = exports.DEFAULT_SERVICE_REGISTRY_SETTINGS_ENV_CONFIG = exports.DEFAULT_RETRY_OPTIONS = exports.DEFAULT_APP_METADATA = exports.CONFIG_SERVICE_NAME = void 0; const observability_1 = require("../../observability"); /** * Custom config preset selector, used to load a specific preset from the custom config folder. * Default files to search for are `./config/custom/presets/*.preset.*` * This preset is used for the custom config. * @defaultValue undefined */ const CONFIG_CUSTOM_PRESET = process.env['CONFIG_CUSTOM_PRESET']; /** * Service registry preset selector, used to load a specific preset from the service registry config folder. * Default files to search for are `./config/presets/*.preset.*` * This preset is used for the service registry config. * @defaultValue undefined */ const CONFIG_SERVICE_REGISTRY_PRESET = process.env['CONFIG_SERVICE_REGISTRY_PRESET']; /** * Application name * @defaultValue 'mdf-app' */ const CONFIG_APP_NAME = process.env['CONFIG_APP_NAME']; /** Health service name */ exports.CONFIG_SERVICE_NAME = 'settings'; /** Default application metadata */ exports.DEFAULT_APP_METADATA = { name: CONFIG_APP_NAME !== null && CONFIG_APP_NAME !== void 0 ? CONFIG_APP_NAME : 'mdf-app', release: '0.0.0', version: '0', description: undefined, // This is a placeholder, the actual value will be set by the service registry instanceId: '00000000-0000-0000-0000-000000000000', serviceId: 'mdf-service', serviceGroupId: 'mdf-service-group', }; /** Default retry options for service startup */ exports.DEFAULT_RETRY_OPTIONS = { attempts: 3, maxWaitTime: 10000, timeout: 5000, waitTime: 1000, }; /** Default service registry settings environment configuration */ exports.DEFAULT_SERVICE_REGISTRY_SETTINGS_ENV_CONFIG = { metadata: 'CONFIG_METADATA_', observabilityOptions: 'CONFIG_OBSERVABILITY_', loggerOptions: 'CONFIG_LOGGER_', retryOptions: 'CONFIG_RETRY_OPTIONS_', adapterOptions: 'CONFIG_ADAPTER_', }; /** Default observability options */ exports.DEFAULT_OBSERVABILITY_OPTIONS = { primaryPort: observability_1.DEFAULT_PRIMARY_PORT, host: 'localhost', isCluster: false, includeStack: observability_1.DEFAULT_CONFIG_REGISTER_INCLUDE_STACK, clusterUpdateInterval: observability_1.DEFAULT_CONFIG_REGISTER_CLUSTER_UPDATE_INTERVAL, maxSize: observability_1.DEFAULT_CONFIG_REGISTER_MAX_LIST_SIZE, }; /** Default logger options */ exports.DEFAULT_LOGGER_OPTIONS = { console: { enabled: true, level: 'info', }, file: { enabled: false, level: 'info', }, }; /** Default custom config loader options */ exports.DEFAULT_CUSTOM_CONFIG_LOADER_OPTIONS = { configFiles: ['./config/custom/*.*'], presetFiles: ['./config/custom/presets/*.*'], schemaFiles: ['./config/custom/schemas/*.*'], preset: CONFIG_CUSTOM_PRESET !== null && CONFIG_CUSTOM_PRESET !== void 0 ? CONFIG_CUSTOM_PRESET : CONFIG_SERVICE_REGISTRY_PRESET, }; /** Default service registry config loader options */ exports.DEFAULT_SERVICE_REGISTRY_CONFIG_CONFIG_LOADER_OPTIONS = { configFiles: ['./config/*.*'], presetFiles: ['./config/presets/*.*'], schemaFiles: ['./config/schemas/*.*'], preset: CONFIG_SERVICE_REGISTRY_PRESET, }; /** Default service registry options */ exports.DEFAULT_SERVICE_REGISTRY_OPTIONS = { metadata: exports.DEFAULT_APP_METADATA, retryOptions: exports.DEFAULT_RETRY_OPTIONS, observabilityOptions: exports.DEFAULT_OBSERVABILITY_OPTIONS, loggerOptions: exports.DEFAULT_LOGGER_OPTIONS, configLoaderOptions: exports.DEFAULT_CUSTOM_CONFIG_LOADER_OPTIONS, }; //# sourceMappingURL=const.js.map