Skip to content

Commit

Permalink
Introduce RPC_URL env variable in worker (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucemans authored Nov 29, 2023
1 parent 929e842 commit e7e9fc1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion worker/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion worker/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "enstate-worker"
version = "1.0.0-1"
version = "1.0.0-2"
edition = "2021"

# https://github.com/rustwasm/wasm-pack/issues/1247
Expand Down
9 changes: 7 additions & 2 deletions worker/src/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,17 @@ impl LookupType {
env: Arc<Env>,
opensea_api_key: &str,
) -> Result<Response, Response> {
let cache = Box::new(CloudflareKVCache::new(env));
let cache = Box::new(CloudflareKVCache::new(env.clone()));
let profile_records = Records::default().records;
let profile_chains = Coins::default().coins;

let rpc_url = env
.var("RPC_URL")
.map(|x| x.to_string())
.unwrap_or("https://rpc.enstate.rs/v1/mainnet".to_string());

// TODO: env
let rpc = Provider::<Http>::try_from("https://rpc.enstate.rs/v1/mainnet")
let rpc = Provider::<Http>::try_from(rpc_url)
.map_err(|_| Response::error("RPC Failure", 500).unwrap())?;

let url = req
Expand Down

0 comments on commit e7e9fc1

Please sign in to comment.