Skip to content

Commit 9058a5a

Browse files
committed
nitro: Create constants for EIF path strings
Signed-off-by: Tyler Fanelli <[email protected]>
1 parent b37a470 commit 9058a5a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/nitro/src/enclave/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ use std::{
2626
use tar::HeaderMode;
2727
use vsock::{VsockAddr, VsockListener, VMADDR_CID_ANY};
2828

29+
const KRUN_NITRO_EIF_PATH_ENV_VAR: &str = "KRUN_NITRO_EIF_PATH";
30+
const KRUN_NITRO_EIF_PATH_DEFAULT: &str = "/usr/share/krun-nitro/krun-nitro.eif";
31+
2932
/// Directories within the configured rootfs that will be ignored when writing to the enclave. The
3033
/// enclave is responsible for initializing these directories within the guest operating system.
3134
const ROOTFS_DIR_DENYLIST: [&str; 6] = [
@@ -119,8 +122,8 @@ impl NitroEnclave {
119122
fn start(&mut self) -> Result<(u32, PollTimeout), StartError> {
120123
// Read the cached EIF file required to run the enclave.
121124
let eif = {
122-
let path = env::var("KRUN_NITRO_EIF_PATH")
123-
.unwrap_or("/usr/share/krun-nitro/krun-nitro.eif".to_string());
125+
let path = env::var(KRUN_NITRO_EIF_PATH_ENV_VAR)
126+
.unwrap_or(KRUN_NITRO_EIF_PATH_DEFAULT.to_string());
124127

125128
fs::read(path).map_err(StartError::EifRead)
126129
}?;

0 commit comments

Comments
 (0)