diff --git a/src/main.rs b/src/main.rs index 15ccd8d..37cd3d6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,7 +21,9 @@ enum Commands{ #[derive(Args)] struct ReviewCommand{ #[arg(long)] - cookie:String, + session_id:String, + #[arg(long)] + api_url:String, } #[derive(Args)] struct UploadScriptsCommand{ @@ -36,7 +38,8 @@ async fn main(){ let cli=Cli::parse(); match cli.command{ Commands::Review(command)=>review(ReviewConfig{ - cookie:command.cookie, + session_id:command.session_id, + api_url:command.api_url, }).await.unwrap(), Commands::UploadScripts(command)=>upload_scripts(UploadConfig{ session_id:command.session_id, @@ -82,14 +85,15 @@ enum ReviewError{ } struct ReviewConfig{ - cookie:String, + session_id:String, + api_url:String, } async fn review(config:ReviewConfig)->Result<(),ReviewError>{ // download unreviewed policies // review them - let cookie=submissions_api::Cookie::new(&config.cookie).map_err(ReviewError::Cookie)?; - let api=submissions_api::external::Context::new("http://localhost:8083".to_owned(),cookie).map_err(ReviewError::Reqwest)?; + let cookie=submissions_api::Cookie::new(&config.session_id).map_err(ReviewError::Cookie)?; + let api=submissions_api::external::Context::new(config.api_url,cookie).map_err(ReviewError::Reqwest)?; let unreviewed_policies=api.get_script_policies(submissions_api::types::GetScriptPoliciesRequest{ Page:1,