aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimbeerserverDE <himbeerserverde@gmail.com>2023-01-17 19:10:19 +0100
committerHimbeerserverDE <himbeerserverde@gmail.com>2023-01-17 19:10:19 +0100
commite7deae22626bd489f6cd6da99f5b125cf45aea4e (patch)
tree48a04c7a983149a3b4ae1efae21ade0c15d680cc
parent078fe46b73f99afcb1ce7b5f809a28354511d4e7 (diff)
use sandbox in debug build and production api in release build
-rw-r--r--src/main.rs24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index 403b90c..938f851 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -387,7 +387,13 @@ fn push_addr4(config: ConfigIpv4, rx: &mpsc::Receiver<Ipv4Net>) -> Result<()> {
let user = config.user.clone();
let pass = config.pass.clone();
- let clt = Client::login(Endpoint::Sandbox, user, pass)?;
+ #[cfg(not(debug_assertions))]
+ let endpoint = Endpoint::Production;
+
+ #[cfg(debug_assertions)]
+ let endpoint = Endpoint::Sandbox;
+
+ let clt = Client::login(endpoint, user, pass)?;
clt.call(RecordUpdate {
ids: config.records.clone(),
@@ -414,7 +420,13 @@ fn push_addr6(config: ConfigIpv6, rx: &mpsc::Receiver<Ipv6Net>) -> Result<()> {
let user = config.user.clone();
let pass = config.pass.clone();
- let clt = Client::login(Endpoint::Sandbox, user, pass)?;
+ #[cfg(not(debug_assertions))]
+ let endpoint = Endpoint::Production;
+
+ #[cfg(debug_assertions)]
+ let endpoint = Endpoint::Sandbox;
+
+ let clt = Client::login(endpoint, user, pass)?;
clt.call(RecordUpdate {
ids: config.records.clone(),
@@ -441,7 +453,13 @@ fn push_net6(config: ConfigNet6, rx: &mpsc::Receiver<Ipv6Net>) -> Result<()> {
let user = config.user.clone();
let pass = config.pass.clone();
- let clt = Client::login(Endpoint::Sandbox, user, pass)?;
+ #[cfg(not(debug_assertions))]
+ let endpoint = Endpoint::Production;
+
+ #[cfg(debug_assertions)]
+ let endpoint = Endpoint::Sandbox;
+
+ let clt = Client::login(endpoint, user, pass)?;
for id in &config.records {
let info: RecordInfoResponse = clt.call(RecordInfoCall {