diff options
Diffstat (limited to 'zkvms_host_io/src')
| -rw-r--r-- | zkvms_host_io/src/lib.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/zkvms_host_io/src/lib.rs b/zkvms_host_io/src/lib.rs index 191d2ad..a3bdb1b 100644 --- a/zkvms_host_io/src/lib.rs +++ b/zkvms_host_io/src/lib.rs @@ -1,10 +1,12 @@ use clap::{Parser, ValueEnum}; use num_traits::NumCast; use serde::{ Serialize, Deserialize }; -use std::fs::read_to_string; +use env_file_reader::read_str; +use std::{ fs::read_to_string, collections::HashMap }; pub use input_macros::foreach_input_field; static DEFAULT_PUBLIC_INPUT: &str = include_str!(concat!(env!("INPUTS_DIR"), "/default_public_input.toml")); +static DEFAULT_ENV: &str = include_str!(concat!(env!("INPUTS_DIR"), "/default.env")); #[derive(Parser, Debug)] #[command(version, about, long_about = None)] @@ -22,10 +24,11 @@ pub enum RunType { Verify, } -#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct RunWith<T> { pub run_type: RunType, pub input: T, + pub default_env: HashMap<String, String>, } input_macros::generate_input_struct!(); @@ -38,10 +41,13 @@ pub fn read_args() -> RunWith<Input> { } else { DEFAULT_PUBLIC_INPUT.to_string() }; - let val: Input = toml::from_str(&contents).unwrap(); + let input: Input = toml::from_str(&contents).unwrap(); + + let default_env = read_str(DEFAULT_ENV).unwrap(); RunWith { run_type: cli.run_type, - input: val, + input, + default_env, } } |
