Skip to content

Commit e7e9fc1

Browse files
authored
Introduce RPC_URL env variable in worker (#31)
1 parent 929e842 commit e7e9fc1

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

worker/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

worker/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "enstate-worker"
3-
version = "1.0.0-1"
3+
version = "1.0.0-2"
44
edition = "2021"
55

66
# https://github.com/rustwasm/wasm-pack/issues/1247

worker/src/lookup.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,17 @@ impl LookupType {
5454
env: Arc<Env>,
5555
opensea_api_key: &str,
5656
) -> Result<Response, Response> {
57-
let cache = Box::new(CloudflareKVCache::new(env));
57+
let cache = Box::new(CloudflareKVCache::new(env.clone()));
5858
let profile_records = Records::default().records;
5959
let profile_chains = Coins::default().coins;
6060

61+
let rpc_url = env
62+
.var("RPC_URL")
63+
.map(|x| x.to_string())
64+
.unwrap_or("https://rpc.enstate.rs/v1/mainnet".to_string());
65+
6166
// TODO: env
62-
let rpc = Provider::<Http>::try_from("https://rpc.enstate.rs/v1/mainnet")
67+
let rpc = Provider::<Http>::try_from(rpc_url)
6368
.map_err(|_| Response::error("RPC Failure", 500).unwrap())?;
6469

6570
let url = req

0 commit comments

Comments
 (0)