Backstage
    Preparing search index...

    A config implementation that can be closed.

    Closing the configuration instance will stop the reading from the underlying source.

    interface ClosableConfig {
        close(): void;
        get<T = JsonValue>(key?: string): T;
        getBoolean(key: string): boolean;
        getConfig(key: string): Config;
        getConfigArray(key: string): Config[];
        getNumber(key: string): number;
        getOptional<T = JsonValue>(key?: string): T | undefined;
        getOptionalBoolean(key: string): boolean | undefined;
        getOptionalConfig(key: string): Config | undefined;
        getOptionalConfigArray(key: string): Config[] | undefined;
        getOptionalNumber(key: string): number | undefined;
        getOptionalString(key: string): string | undefined;
        getOptionalStringArray(key: string): string[] | undefined;
        getString(key: string): string;
        getStringArray(key: string): string[];
        has(key: string): boolean;
        keys(): string[];
        subscribe?(onChange: () => void): { unsubscribe: () => void };
    }

    Hierarchy (View Summary)

    Index

    Methods

    • Closes the configuration instance.

      Returns void

      The configuration instance will still be usable after closing, but it will no longer be updated with new values from the underlying source.

    • Read out all configuration data for the given key.

      Usage of this method should be avoided as the typed alternatives provide much better error reporting. The main use-case of this method is to determine the type of a configuration value in the case where there are multiple possible shapes of the configuration.

      Type Parameters

      Parameters

      • Optionalkey: string

      Returns T | undefined

    • Subscribes to the configuration object in order to receive a notification whenever any value within the configuration has changed.

      This method is optional to implement, and consumers need to check if it is implemented before invoking it.

      Parameters

      • onChange: () => void

      Returns { unsubscribe: () => void }