Skip to content

Commit 57623ac

Browse files
committed
feat: add conditional registry registration based on environment variable
1 parent e6baca0 commit 57623ac

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ REGISTRY_URL="http://localhost:8081"
66
NODE_NAME="node-eu1"
77
NODE_HOST="host.docker.internal"
88
NODE_API_URL="http://host.docker.internal:8080"
9-
CONTACT_EMAIL="ops@hushnet.net"
9+
CONTACT_EMAIL="ops@hushnet.net"
10+
REGISTER_TO_REGISTRY="true"

src/main.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,14 @@ async fn main() -> Result<(), anyhow::Error> {
3434
env::var("REGISTRY_URL").unwrap_or_else(|_| "https://registry.hushnet.net".into());
3535
let keys = NodeKeys::load_or_generate()?;
3636
println!("Public key (base64): {}", keys.public_b64);
37-
register_with_registry(&registry_url).await?;
37+
if env::var("REGISTER_TO_REGISTRY")
38+
.unwrap_or_else(|_| "false".into())
39+
.to_lowercase()
40+
== "true"
41+
{
42+
println!("Registering with registry at {}", registry_url);
43+
register_with_registry(&registry_url).await?;
44+
}
3845

3946
let state: AppState = AppState {
4047
pool: pool.clone(),

0 commit comments

Comments
 (0)