0.5.1-pre.007
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: ks-pipeline-demo-scenarios/src/environment.rs
|
||||
// version: 6
|
||||
// version: 7
|
||||
|
||||
//! Environment initialization for opt-in demonstration scenarios.
|
||||
|
||||
@@ -10,6 +10,36 @@ pub fn initialize_demo_scenario_environment(
|
||||
return ks_config::load_workspace_environment(workspace_root);
|
||||
}
|
||||
|
||||
/// Loads the shared default Solana configuration or one explicit scenario composition override.
|
||||
///
|
||||
/// Shared documents are the canonical default when `KS_DEVNET_CONFIG_PATH` is absent.
|
||||
/// An explicit path may select a dedicated composition without making one mandatory for scenarios.
|
||||
pub fn load_demo_scenario_config(
|
||||
workspace_root: &std::path::Path,
|
||||
) -> ks_core::Result<ks_config::AppConfig> {
|
||||
match initialize_demo_scenario_environment(workspace_root) {
|
||||
std::result::Result::Ok(_) => (),
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
}
|
||||
let configured_path = std::env::var("KS_DEVNET_CONFIG_PATH")
|
||||
.ok()
|
||||
.map(|value| return value.trim().to_string())
|
||||
.filter(|value| return !value.is_empty());
|
||||
if let std::option::Option::Some(value) = configured_path {
|
||||
let path = std::path::PathBuf::from(value);
|
||||
let resolved_path = if path.is_absolute() { path } else { workspace_root.join(path) };
|
||||
let composed = match ks_config::read_composed_app_config_with_environment(
|
||||
resolved_path.as_path(),
|
||||
workspace_root,
|
||||
) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(composed.app_config);
|
||||
}
|
||||
return ks_config::read_default_shared_app_config_with_environment(workspace_root);
|
||||
}
|
||||
|
||||
/// Resolves one compatible Devnet profile for demo scenarios.
|
||||
///
|
||||
/// An explicit name has priority, followed by `KS_DEVNET_PROFILE`, then the
|
||||
|
||||
Reference in New Issue
Block a user