diff --git a/worker/Cargo.lock b/worker/Cargo.lock index 227cf2e..86ceac6 100644 --- a/worker/Cargo.lock +++ b/worker/Cargo.lock @@ -829,7 +829,7 @@ dependencies = [ [[package]] name = "enstate-worker" -version = "1.0.0-1" +version = "1.0.0-2" dependencies = [ "async-trait", "chrono", diff --git a/worker/Cargo.toml b/worker/Cargo.toml index a7d5b94..296e768 100644 --- a/worker/Cargo.toml +++ b/worker/Cargo.toml @@ -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 diff --git a/worker/src/lookup.rs b/worker/src/lookup.rs index 6b00ef0..8087aea 100644 --- a/worker/src/lookup.rs +++ b/worker/src/lookup.rs @@ -54,12 +54,17 @@ impl LookupType { env: Arc, opensea_api_key: &str, ) -> Result { - 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::::try_from("https://rpc.enstate.rs/v1/mainnet") + let rpc = Provider::::try_from(rpc_url) .map_err(|_| Response::error("RPC Failure", 500).unwrap())?; let url = req