@mdf.js/service-registry
Version:
MMS - API - Service Registry
82 lines • 4.35 kB
TypeScript
/**
* 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.
*/
import { Health, Layer } from '@mdf.js/core';
import { Links, Multi } from '@mdf.js/crash';
import { LoggerConfig } from '@mdf.js/logger';
import { ConfigManager } from '@mdf.js/service-setup-provider';
import { RetryOptions } from '@mdf.js/utils';
import express from 'express';
import { ObservabilityOptions } from '../observability';
import { BootstrapOptions, CustomSetting, ServiceRegistryOptions, ServiceRegistrySettings, ServiceSetting } from '../types';
import { SettingsManagerBase } from './SettingsManagerBase';
/**
* SettingsManager is responsible for managing the application's settings, including the
* configuration for the service registry and custom settings specified by the user. It extends
* EventEmitter to allow for emitting events related to settings management and implements the
* Service interface from the Layer.App namespace, indicating its role in the application's service
* architecture. It utilizes configuration managers for both service registry and custom settings,
* supporting dynamic loading and management of these configurations.
*
* Additionally, it can load application metadata from package.json and README.md content, providing
* a centralized way to access application information and documentation.
*/
export declare class SettingsManagerAccessors<CustomSettings extends Record<string, CustomSetting> = Record<string, CustomSetting>> extends SettingsManagerBase<CustomSettings> implements Layer.App.Service {
/** Settings Manager Router */
private readonly _router;
/**
* Constructs a SettingsManager instance, initializing configuration providers and loading
* `package.json` and README information.
* @param bootstrapOptions - Bootstrap settings, define how the Custom and the Service Registry
* settings should be loaded.
* @param serviceRegistryOptions - Service Registry settings, used as a base for the Service
* Registry configuration manager.
* @param customSettings - Custom settings provided by the user, used as a base for the Custom
* configuration manager.
*/
constructor(bootstrapOptions?: BootstrapOptions, serviceRegistryOptions?: ServiceRegistryOptions<CustomSettings>, customSettings?: Partial<CustomSettings>);
/** @returns Service name */
get name(): string;
/** @returns Service instance identifier */
get componentId(): string;
/** @returns Settings manager status */
get status(): Health.Status;
/** @returns Settings manager checks */
get checks(): Health.Checks;
/** @returns A validation error, if exist, in the configuration loaded */
get error(): Multi | undefined;
/** @returns Service Metadata */
get metadata(): Layer.App.Metadata;
/** @returns Application namespace */
get namespace(): string | undefined;
/** @returns Application release */
get release(): string;
/** @returns Observability options */
get observability(): ObservabilityOptions;
/** @returns Logger configuration */
get logger(): LoggerConfig | undefined;
/** @returns If the application is the primary node in the cluster */
get isPrimary(): boolean;
/** @returns If the application is a worker node in the cluster */
get isWorker(): boolean;
/** @returns Service Register Configuration Manager */
get serviceRegisterConfigManager(): ConfigManager<ServiceRegistryOptions<CustomSettings>>;
/** @returns Service Register settings */
get serviceRegistrySettings(): ServiceRegistrySettings<CustomSettings>;
/** @returns Custom Configuration Manager */
get customRegisterConfigManager(): ConfigManager<CustomSettings>;
/** @returns Custom settings */
get customSettings(): CustomSettings;
/** @returns Service settings */
get settings(): ServiceSetting<CustomSettings>;
/** Get the retry options */
get retryOptions(): RetryOptions | undefined;
/** @returns Express router with access to config information */
get router(): express.Router;
/** @returns Links offered by this service */
get links(): Links;
}
//# sourceMappingURL=SettingsManagerAccessors.d.ts.map