Skip to content

Commit

Permalink
update: changes on create environment due to swarm mode changes
Browse files Browse the repository at this point in the history
  • Loading branch information
biswaroop1547 committed Nov 3, 2023
1 parent 374ac43 commit 47157d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 7 additions & 2 deletions src-tauri/src/controller_binaries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use crate::{
download::Downloader,
swarm::{create_environment, Config},
err,
errors::{Context, Result},
logerr, Service, SharedState,
Expand Down Expand Up @@ -130,9 +131,13 @@ pub async fn start_service(
.collect();
log::info!("args: {:?}", args);

let mut env_vars: HashMap<String, String> = HashMap::new();
let config = Config::new();
let mut env_vars = HashMap::new();
env_vars.insert("PREM_APPDIR".to_string(), config.app_data_dir);
env_vars.insert("PREM_PYTHON".to_string(), config.python);

if is_petals_model {
(_, env_vars) = create_environment(handle);
create_environment(handle);
}

let child = Command::new(&binary_path)
Expand Down
8 changes: 4 additions & 4 deletions src-tauri/src/swarm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ pub fn is_swarm_supported() -> bool {
}
}

struct Config {
app_data_dir: String,
python: String,
pub struct Config {
pub app_data_dir: String,
pub python: String,
}

impl Config {
fn new() -> Self {
pub fn new() -> Self {
let mut app_data_dir =
tauri::api::path::home_dir().expect("🙈 Failed to get app data directory");
app_data_dir.push(".config/prem");
Expand Down

0 comments on commit 47157d4

Please sign in to comment.