Skip to content

Commit

Permalink
Error on env
Browse files Browse the repository at this point in the history
  • Loading branch information
hanneary committed Dec 10, 2024
1 parent 15a0343 commit 8264d3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 6 additions & 6 deletions control-plane/src/configuration.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::str::FromStr;
use std::{env::VarError, str::FromStr};

use openssl::{
ec::EcKey,
Expand Down Expand Up @@ -132,11 +132,11 @@ pub fn get_team_uuid() -> String {
std::env::var("EV_TEAM_UUID").expect("EV_TEAM_UUID is not set in env")
}

pub fn get_enclave_run_config() -> EnclaveRunConfig {
let num_cpus = std::env::var("ENCLAVE_NUM_CPUS").unwrap_or_else(|_| "2".to_string());
let ram_size_mib = std::env::var("ENCLAVE_RAM_SIZE_MIB").unwrap_or_else(|_| "512".to_string());
let debug_mode = std::env::var("ENCLAVE_DEBUG_MODE").unwrap_or_else(|_| "false".to_string());
EnclaveRunConfig::new(num_cpus, ram_size_mib, debug_mode)
pub fn get_enclave_run_config() -> Result<EnclaveRunConfig, VarError> {
let num_cpus = std::env::var("ENCLAVE_NUM_CPUS")?;
let ram_size_mib = std::env::var("ENCLAVE_RAM_SIZE_MIB")?;
let debug_mode = std::env::var("ENCLAVE_DEBUG_MODE")?;
Ok(EnclaveRunConfig::new(num_cpus, ram_size_mib, debug_mode))
}

pub fn get_cert_provisoner_host() -> String {
Expand Down
4 changes: 3 additions & 1 deletion control-plane/src/orchestration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ pub enum OrchestrationError {
SerdeError(#[from] serde_json::Error),
#[error(transparent)]
Io(#[from] std::io::Error),
#[error(transparent)]
VarError(#[from] std::env::VarError),
}

static EMPTY_VEC: Vec<Value> = Vec::new();
Expand Down Expand Up @@ -56,7 +58,7 @@ impl Orchestration {
}

pub async fn start_enclave() -> Result<(), OrchestrationError> {
let run_config = get_enclave_run_config();
let run_config = get_enclave_run_config()?;

info!("[HOST] Checking for running enclaves...");

Expand Down

0 comments on commit 8264d3c

Please sign in to comment.