Sets DNS records on Porkbun for the specified domain using the
/api/json/v3/dns/create/{domain} endpoint of Porkbun's API. DNS records must be
provided as a dataframe/tibble with the columns
type, hostname, value, ttl, priority, weight, port, flag, tag and target. Further columns are silently ignored.
Usage
porkbun_dns_records_set(
records,
domain,
api_key = funky::config_val("porkbun_api_key"),
secret_api_key = funky::config_val("porkbun_secret_api_key"),
max_tries = 3L
)Arguments
- records
DNS records. A dataframe/tibble with the columns
type,hostname,value,ttl,priority,weight,port,flag,tagandtarget. The first three columns are mandatory, columns not listed here are silently ignored.- domain
Domain name to set DNS records for. A character scalar.
- api_key
Porkbun API key used for authentication. A character scalar.
- secret_api_key
Porkbun secret API key used for authentication. A character scalar.
- max_tries
Maximum number of request attempts in case of an HTTP error. An integerish scalar. Retries are performed using exponential backoff and jitter, see
httr2::req_retry()for details.
Details
Supported are the DNS record types A, AAAA, ALIAS, CAA, CNAME, HTTPS, MX, NS, SRV, SVCB, TLSA and TXT.
See also
Other Porkbun functions:
porkbun_dns_records_delete(),
porkbun_dns_records_get()
Examples
if (FALSE) { # \dontrun{
tibble::tribble(
~type, ~hostname, ~value, ~ttl, ~priority, ~weight, ~port, ~flag, ~tag,
"CAA", "my.site", "letsencrypt.org", 3600L, NA, NA, NA, 0L, "issue",
"CNAME", "autoconfig", "mailbox.org", 3600L, NA, NA, NA, NA, NA,
"MX", "my.site", "mxext1.mailbox.org", 3600L, NA, NA, NA, NA, NA,
"SRV", "_hkps._tcp.my.site", "pgp.mailbox.org", 3600L, 1L, 1L, 443L, NA, NA,
"TXT", "_mta-sts", "v=STSv1; id=001", 3600L, NA, NA, NA, NA, NA) |>
yay::porkbun_dns_records_set(domain = "my.site")
# to use a TOML file that defines a `records` table as input:
pal::toml_read("dns_records.toml")$records |>
purrr::map_dfr(tibble::as_tibble_row) |>
yay::porkbun_dns_records_set(domain = "my.site")} # }