Skip to content

Commit 9b9a19c

Browse files
committed
Temporarily support legacy schema return from the backend
1 parent ab1ef0c commit 9b9a19c

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

crates/cli/src/config_file.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ pub fn get_config(
9494
let text = decode_base64_string(remote_config_base64)
9595
.context("error when decoding base64 remote config")?;
9696

97-
let res = file_v1::parse_yaml(&text).inspect_err(|err| {
97+
////////
98+
use kernel::config::common::{parse_any_schema_yaml, WithVersion};
99+
// (There is temporary support for the backend returning a legacy schema -- this will be converted to
100+
// `file_v1::parse_yaml` in a future minor version)
101+
let res = parse_any_schema_yaml(&text).inspect_err(|err| {
98102
if debug {
99103
eprintln!("Error when parsing remote config: {err:?}");
100104
eprintln!("Proceeding with local config");
@@ -103,7 +107,10 @@ pub fn get_config(
103107
let Ok(remote_yaml) = res else {
104108
return Ok(local_config.map(|c| (c, ConfigMethod::File)));
105109
};
106-
let remote_config: file_v1::ConfigFile = remote_yaml.into();
110+
let remote_config: file_v1::ConfigFile = match remote_yaml {
111+
WithVersion::Legacy(legacy) => file_v1::YamlConfigFile::from(legacy).into(),
112+
WithVersion::CodeSecurity(v1) => v1.into(),
113+
};
107114

108115
let config_method = if local_config.is_some() {
109116
ConfigMethod::RemoteConfigurationWithFile

0 commit comments

Comments
 (0)