porkbun: Inline unnecessary variables

This commit is contained in:
Richard Hansen 2024-07-23 01:31:34 -04:00
parent 45d832145f
commit bafd5a8715

View file

@ -6790,18 +6790,15 @@ sub nic_porkbun_update {
my $rrset_type = $ipv eq '4' ? 'A' : 'AAAA'; my $rrset_type = $ipv eq '4' ? 'A' : 'AAAA';
info("setting ipv%s address to %s for %s", $ipv, $ip, $h); info("setting ipv%s address to %s for %s", $ipv, $ip, $h);
verbose("UPDATE:","updating %s", $h); verbose("UPDATE:","updating %s", $h);
my $url = "https://porkbun.com/api/json/v3/dns/retrieveByNameType/$domain/$rrset_type/$sub_domain";
my $data = encode_json({
secretapikey => $config{$h}{'secretapikey'},
apikey => $config{$h}{'apikey'},
});
my $header = "Content-Type: application/json\n";
my $reply = geturl( my $reply = geturl(
proxy => opt('proxy'), proxy => opt('proxy'),
url => $url, url => "https://porkbun.com/api/json/v3/dns/retrieveByNameType/$domain/$rrset_type/$sub_domain",
headers => $header, headers => ['Content-Type: application/json'],
method => 'POST', method => 'POST',
data => $data, data => encode_json({
secretapikey => $config{$h}{'secretapikey'},
apikey => $config{$h}{'apikey'},
}),
); );
if (!defined($reply) || !$reply) { if (!defined($reply) || !$reply) {
$config{$h}{"status-ipv$ipv"} = "bad"; $config{$h}{"status-ipv$ipv"} = "bad";
@ -6841,20 +6838,18 @@ sub nic_porkbun_update {
my $notes = $records->[0]->{'notes'}; my $notes = $records->[0]->{'notes'};
debug("ttl = %s", $ttl); debug("ttl = %s", $ttl);
debug("notes = %s", $notes); debug("notes = %s", $notes);
$url = "https://porkbun.com/api/json/v3/dns/editByNameType/$domain/$rrset_type/$sub_domain";
$data = encode_json({
secretapikey => $config{$h}{'secretapikey'},
apikey => $config{$h}{'apikey'},
content => $ip,
ttl => $ttl,
notes => $notes,
});
$reply = geturl( $reply = geturl(
proxy => opt('proxy'), proxy => opt('proxy'),
url => $url, url => "https://porkbun.com/api/json/v3/dns/editByNameType/$domain/$rrset_type/$sub_domain",
headers => $header, headers => ['Content-Type: application/json'],
method => 'POST', method => 'POST',
data => $data, data => encode_json({
secretapikey => $config{$h}{'secretapikey'},
apikey => $config{$h}{'apikey'},
content => $ip,
ttl => $ttl,
notes => $notes,
}),
); );
if (!defined($reply) || !$reply) { if (!defined($reply) || !$reply) {
failed("updating %s: Could not connect to porkbun.com.", $h); failed("updating %s: Could not connect to porkbun.com.", $h);