Merge pull request #8406 from prkeshri/7340-remote-config-fix

7340 remote config fix
This commit is contained in:
Fredrik Adelöw
2021-12-17 10:34:32 +01:00
committed by GitHub
7 changed files with 48 additions and 4 deletions
+11 -3
View File
@@ -45,7 +45,7 @@ export type LoadConfigOptionsWatch = {
export type LoadConfigOptionsRemote = {
/**
* An optional remote config reloading period, in seconds
* A remote config reloading period, in seconds
*/
reloadIntervalSeconds: number;
};
@@ -114,8 +114,16 @@ export async function loadConfig(
.filter((e): e is { url: string } => e.hasOwnProperty('url'))
.map(configTarget => configTarget.url);
if (remote === undefined && configUrls.length > 0) {
throw new Error(`Remote config detected but this feature is turned off`);
if (remote === undefined) {
if (configUrls.length > 0) {
throw new Error(
`Please make sure you are passing the remote option when loading remote configurations. See https://backstage.io/docs/conf/writing#configuration-files for detailed info.`,
);
}
} else if (remote.reloadIntervalSeconds <= 0) {
throw new Error(
`Remote config must be contain a non zero reloadIntervalSeconds: <seconds> value`,
);
}
// If no paths are provided, we default to reading