From f8112cb2852d9f2d0d43cc06cd20a49359c84a4b Mon Sep 17 00:00:00 2001 From: Iulian Barbu <14218860+iulianbarbu@users.noreply.github.com> Date: Tue, 11 Apr 2023 14:48:37 +0300 Subject: [PATCH] runtime: infer environment based on storage type (#786) --- runtime/src/alpha/mod.rs | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/runtime/src/alpha/mod.rs b/runtime/src/alpha/mod.rs index 98a5cb94c..2c90124de 100644 --- a/runtime/src/alpha/mod.rs +++ b/runtime/src/alpha/mod.rs @@ -66,22 +66,20 @@ pub async fn start(loader: impl Loader + Send + 'static) { // to clone it in the `ProvisionerFactory::new` call in the alpha runtime `load` method. // We might be able to optimize this by implementing clone for a Box // or by using static dispatch instead. - let storage_manager: Arc = match args.storage_manager_type { - args::StorageManagerType::Artifacts => { - Arc::new(ArtifactsStorageManager::new(args.storage_manager_path)) - } - args::StorageManagerType::WorkingDir => { - Arc::new(WorkingDirStorageManager::new(args.storage_manager_path)) - } - }; + let (storage_manager, env): (Arc, Environment) = + match args.storage_manager_type { + args::StorageManagerType::Artifacts => ( + Arc::new(ArtifactsStorageManager::new(args.storage_manager_path)), + Environment::Production, + ), + args::StorageManagerType::WorkingDir => ( + Arc::new(WorkingDirStorageManager::new(args.storage_manager_path)), + Environment::Local, + ), + }; let router = { - let alpha = Alpha::new( - provisioner_address, - loader, - storage_manager, - Environment::Local, - ); + let alpha = Alpha::new(provisioner_address, loader, storage_manager, env); let svc = RuntimeServer::new(alpha); server_builder.add_service(svc)