feat(acp): replace raw config and secret methods (#9000)
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
This commit is contained in:
@@ -719,6 +719,20 @@ impl Config {
|
||||
self.save_values(&values)
|
||||
}
|
||||
|
||||
/// Set multiple configuration values in the config file with one read and one write.
|
||||
pub fn set_param_values(&self, updates: &[(String, Value)]) -> Result<(), ConfigError> {
|
||||
if updates.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let _guard = self.guard.lock().unwrap();
|
||||
let mut values = self.load_write_config()?;
|
||||
for (key, value) in updates {
|
||||
values.insert(serde_yaml::to_value(key)?, serde_yaml::to_value(value)?);
|
||||
}
|
||||
self.save_values(&values)
|
||||
}
|
||||
|
||||
/// Delete a configuration value in the config file.
|
||||
///
|
||||
/// This will immediately write the value to the config file. The value
|
||||
|
||||
Reference in New Issue
Block a user