config: Add api to fetch config from default config path

Add api to fetch config from default config path and use that in
kata-ctl tool.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
This commit is contained in:
Archana Shinde 2023-04-25 15:14:52 -07:00
parent b908a780a0
commit 1016bc17b7
2 changed files with 9 additions and 1 deletions

View File

@ -127,6 +127,14 @@ impl TomlConfig {
result result
} }
/// Load raw Kata configuration information from default configuration file.
///
/// Configuration file is probed according to the default configuration file list
/// default::DEFAULT_RUNTIME_CONFIGURATIONS.
pub fn load_from_default() -> Result<(TomlConfig, PathBuf)> {
Self::load_raw_from_file("")
}
/// Load raw Kata configuration information from configuration files. /// Load raw Kata configuration information from configuration files.
/// ///
/// If `config_file` is valid, it will used, otherwise a built-in default path list will be /// If `config_file` is valid, it will used, otherwise a built-in default path list will be

View File

@ -449,7 +449,7 @@ pub fn handle_env(env_args: EnvArgument) -> Result<()> {
Box::new(io::stdout()) Box::new(io::stdout())
}; };
let (toml_config, _) = TomlConfig::load_raw_from_file("").context("load toml config")?; let (toml_config, _) = TomlConfig::load_from_default().context("load toml config")?;
let env_info = get_env_info(&toml_config)?; let env_info = get_env_info(&toml_config)?;