Skip to content

Commit 92bea39

Browse files
authored
fix: Add error handling for config.yaml (kyma-project#4634)
* fix: Add error handling for config.yaml * fix: Add empty object assignment
1 parent 6f945be commit 92bea39

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/state/configuration/configurationAtom.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,14 @@ const getConfigs = async (fetchFn: FetchFn | undefined) => {
6161
}
6262
}
6363

64-
const configParams = jsyaml.load(await configResponse.text()) as Config;
64+
// Check if there is config.yaml - case for deploying Busola in a Cluster
65+
let configParams: Config = {};
66+
try {
67+
configParams = jsyaml.load(await configResponse.text()) as Config;
68+
} catch (e) {
69+
console.warn('Cannot load config.yaml: ', e);
70+
}
71+
6572
const mapParams = configMapResponse?.data?.config
6673
? (jsyaml.load(configMapResponse.data.config) as Config)
6774
: {};

0 commit comments

Comments
 (0)