Skip to content

Commit 3d52147

Browse files
committed
separate endpoints further.
1 parent 0342b99 commit 3d52147

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/main.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ fn main() {
3030
};
3131

3232
let ip: String;
33+
let endpoint: &str = match config.ip.ipv6 {
34+
true => ENDPOINT,
35+
false => ENDPOINT_IPV4,
36+
};
3337
match config.ip.address.is_empty() {
3438
true => {
35-
let ping_endpoint = match config.ip.ipv6 {
36-
true => format!("{}/ping", ENDPOINT),
37-
false => format!("{}/ping", ENDPOINT_IPV4),
38-
};
3939
let ping_response: Value = agent
40-
.post(&ping_endpoint)
40+
.post(&format!("{}/ping", endpoint))
4141
.send_json(&keys)
4242
.unwrap()
4343
.into_json()
@@ -72,7 +72,7 @@ fn main() {
7272

7373
let records_endpoint = format!(
7474
"{}/dns/retrieveByNameType/{}/{}/{}",
75-
ENDPOINT, &config.domain.base, record_type, &config.domain.subdomain
75+
endpoint, &config.domain.base, record_type, &config.domain.subdomain
7676
);
7777
let records_response: RecordsResponse = agent
7878
.post(&records_endpoint)
@@ -95,7 +95,7 @@ fn main() {
9595
);
9696
return;
9797
}
98-
let delete_endpoint = format!("{}/dns/delete/{}/{}", ENDPOINT, &config.domain.base, x.id);
98+
let delete_endpoint = format!("{}/dns/delete/{}/{}", endpoint, &config.domain.base, x.id);
9999
let delete_response: Value = agent
100100
.post(&delete_endpoint)
101101
.send_json(&keys)
@@ -115,7 +115,7 @@ fn main() {
115115
println!("No record to be deleted.")
116116
}
117117

118-
let create_endpoint = format!("{}/dns/create/{}", ENDPOINT, &config.domain.base);
118+
let create_endpoint = format!("{}/dns/create/{}", endpoint, &config.domain.base);
119119
let create_body = CreateRecord {
120120
secretapikey: keys.secretapikey,
121121
apikey: keys.apikey,

0 commit comments

Comments
 (0)