Skip to content

Commit

Permalink
refactoring of relay-client
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Quinn committed Dec 28, 2024
1 parent 2254f01 commit 8b53a53
Show file tree
Hide file tree
Showing 7 changed files with 418 additions and 408 deletions.
2 changes: 1 addition & 1 deletion endpoints/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
edition = "2021"
license = "MIT OR (Apache-2.0 WITH LLVM-exception)"
repository = "https://github.com/worldcoin/orb-software"
rust-version = "1.77.0"
rust-version = "1.82.0"

[dependencies]
hex = "0.4.3"
Expand Down
2 changes: 2 additions & 0 deletions endpoints/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pub enum Backend {
Prod,
Staging,
Analysis,
Local,
}

impl Backend {
Expand Down Expand Up @@ -66,6 +67,7 @@ impl FromStr for Backend {
"prod" | "production" => Ok(Self::Prod),
"stage" | "staging" | "dev" | "development" => Ok(Self::Staging),
"analysis" | "analysis.ml" | "analysis-ml" => Ok(Self::Analysis),
"local" => Ok(Self::Local),
_ => Err(BackendParseErr),
}
}
Expand Down
5 changes: 4 additions & 1 deletion endpoints/src/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub struct Endpoints {
pub ai_volume: Url,
pub auth: Url,
pub ping: Url,
pub relay: Url,
}

impl Endpoints {
Expand All @@ -20,7 +21,7 @@ impl Endpoints {
pub fn new(backend: Backend, orb_id: &OrbId) -> Self {
let subdomain = match backend {
Backend::Prod => "orb",
Backend::Staging => "stage.orb",
Backend::Staging | Backend::Local => "stage.orb",
Backend::Analysis => "analysis.ml",
};

Expand All @@ -47,6 +48,8 @@ impl Endpoints {
orb_id,
"",
),
relay: Url::parse(&format!("https://relay.{subdomain}.worldcoin.org/"))
.expect("urls with validated orb ids should always parse"),
}
}
}
Expand Down
11 changes: 9 additions & 2 deletions relay-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
[package]
name = "orb-relay-client"
version = "0.1.0"
edition.workspace = true
publish = false

# orb-core can't consume crates that use workspace inheritance :(
edition = "2021"
license = "MIT OR (Apache-2.0 WITH LLVM-exception)"
repository = "https://github.com/worldcoin/orb-software"
rust-version = "1.82.0"

[dependencies]
clap = { version = "4", features = ["derive"] }
clap = { version = "4", features = ["derive", "env"] }
derive_more = { workspace = true, features = ["deref", "from", "into"] }
eyre.workspace = true
orb-endpoints.workspace = true
orb-relay-messages.workspace = true
orb-security-utils = { workspace = true, features = ["reqwest"] }
rand = "0.8"
Expand Down
Loading

0 comments on commit 8b53a53

Please sign in to comment.