Skip to content

Commit

Permalink
Modify the signer example to add an option to return directly. (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenlu authored Mar 20, 2024
1 parent b16f984 commit 86e2d5e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/lightspark-remote-signing-server/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub struct Config {
pub webhook_secret: String,
pub master_seed_hex: String,
pub api_port: u16,
pub respond_directly: bool,
}

impl Config {
Expand All @@ -16,6 +17,7 @@ impl Config {
let webhook_secret = std::env::var("RK_WEBHOOK_SECRET").ok();
let master_seed_hex = std::env::var("RK_MASTER_SEED_HEX").ok();
let api_port = std::env::var("PORT").ok();
let respond_directly = std::env::var("RESPOND_DIRECTLY").is_ok();

Self {
api_endpoint,
Expand All @@ -27,6 +29,7 @@ impl Config {
.unwrap_or("8080".to_string())
.parse()
.expect("api port"),
respond_directly,
}
}
}
4 changes: 4 additions & 0 deletions examples/lightspark-remote-signing-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ async fn webhook_handler(

debug!("Response {:?}", response);

if data.respond_directly {
return HttpResponse::Ok().json(response.variables);
}

let result = client
.execute_graphql_request_variable(&response.query, response.variables)
.await;
Expand Down

0 comments on commit 86e2d5e

Please sign in to comment.