@@ -49,8 +49,8 @@ export type LoadConfigOptions = {
|
||||
configTargets: ConfigTarget[];
|
||||
env?: string;
|
||||
experimentalEnvFunc?: EnvFunc;
|
||||
remote?: Remote;
|
||||
watch?: Watch;
|
||||
remote?: LoadConfigOptionsRemote;
|
||||
watch?: LoadConfigOptionsWatch;
|
||||
};
|
||||
|
||||
// @public
|
||||
@@ -75,10 +75,10 @@ export function readEnvConfig(env: {
|
||||
[name: string]: string | undefined;
|
||||
}): AppConfig[];
|
||||
|
||||
// Warning: (ae-missing-release-tag) "Remote" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
// Warning: (ae-missing-release-tag) "LoadConfigOptionsRemote" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export type Remote = {
|
||||
export type LoadConfigOptionsRemote = {
|
||||
reloadIntervalSeconds: number;
|
||||
};
|
||||
|
||||
@@ -90,10 +90,10 @@ export type TransformFunc<T extends number | string | boolean> = (
|
||||
},
|
||||
) => T | undefined;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "Watch" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
// Warning: (ae-missing-release-tag) "LoadConfigOptionsWatch" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export type Watch = {
|
||||
export type LoadConfigOptionsWatch = {
|
||||
onChange: (configs: AppConfig[]) => void;
|
||||
stopSignal?: Promise<void>;
|
||||
};
|
||||
|
||||
@@ -30,4 +30,9 @@ export type {
|
||||
TransformFunc,
|
||||
} from './lib';
|
||||
export { loadConfig } from './loader';
|
||||
export type { ConfigTarget, LoadConfigOptions, Watch, Remote } from './loader';
|
||||
export type {
|
||||
ConfigTarget,
|
||||
LoadConfigOptions,
|
||||
LoadConfigOptionsWatch,
|
||||
LoadConfigOptionsRemote,
|
||||
} from './loader';
|
||||
|
||||
@@ -31,7 +31,7 @@ import { isValidUrl } from '@backstage/integration';
|
||||
|
||||
export type ConfigTarget = { path: string } | { url: string };
|
||||
|
||||
export type Watch = {
|
||||
export type LoadConfigOptionsWatch = {
|
||||
/**
|
||||
* A listener that is called when a config file is changed.
|
||||
*/
|
||||
@@ -43,7 +43,7 @@ export type Watch = {
|
||||
stopSignal?: Promise<void>;
|
||||
};
|
||||
|
||||
export type Remote = {
|
||||
export type LoadConfigOptionsRemote = {
|
||||
/**
|
||||
* An optional remote config reloading period, in seconds
|
||||
*/
|
||||
@@ -71,12 +71,12 @@ export type LoadConfigOptions = {
|
||||
/**
|
||||
* An optional remote config
|
||||
*/
|
||||
remote?: Remote;
|
||||
remote?: LoadConfigOptionsRemote;
|
||||
|
||||
/**
|
||||
* An optional configuration that enables watching of config files.
|
||||
*/
|
||||
watch?: Watch;
|
||||
watch?: LoadConfigOptionsWatch;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -198,7 +198,7 @@ export async function loadConfig(
|
||||
|
||||
const envConfigs = await readEnvConfig(process.env);
|
||||
|
||||
const watchConfigFile = (watchProp: Watch) => {
|
||||
const watchConfigFile = (watchProp: LoadConfigOptionsWatch) => {
|
||||
const watcher = chokidar.watch(configPaths, {
|
||||
usePolling: process.env.NODE_ENV === 'test',
|
||||
});
|
||||
@@ -227,7 +227,10 @@ export async function loadConfig(
|
||||
}
|
||||
};
|
||||
|
||||
const watchRemoteConfig = (watchProp: Watch, remoteProp: Remote) => {
|
||||
const watchRemoteConfig = (
|
||||
watchProp: LoadConfigOptionsWatch,
|
||||
remoteProp: LoadConfigOptionsRemote,
|
||||
) => {
|
||||
const hasConfigChanged = async (
|
||||
oldRemoteConfigs: AppConfig[],
|
||||
newRemoteConfigs: AppConfig[],
|
||||
|
||||
Reference in New Issue
Block a user