Fixed bug in backend-common to allow passing of remote option in order to enable passing remote url in --config option. The remote option should be passed along with reloadIntervalSeconds from packages/backend/src/index.ts (Updated the file as well)
Signed-off-by: Praveen Ranjan Keshri <prkeshri@gmail.com>
This commit is contained in:
@@ -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;
|
||||
};
|
||||
@@ -126,8 +126,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(
|
||||
`Remote config detected but this feature is turned off. Please enable by passing remote option in loadBackendConfig() call inside packages/backend/src/index.ts. See https://backstage.io/docs/conf/writing#configuration-files for detailed info.`,
|
||||
);
|
||||
}
|
||||
} else if (remote.reloadIntervalSeconds === undefined) {
|
||||
throw new Error(
|
||||
`Remote config must be contain reloadIntervalSeconds: <seconds> value`,
|
||||
);
|
||||
}
|
||||
|
||||
// If no paths are provided, we default to reading
|
||||
|
||||
Reference in New Issue
Block a user