Skip to content

tonyd33/porkbun-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

porkbun-cli

A tiny shell script for interacting with the Porkbun API.

See the docs to get an API key first.

Quick start

Dependencies

  • curl (widely available)
  • getopt (widely available)
  • jq

Configuration

To avoid having having your credentials stored in the command history, configure a file in ~/.config/porkbun-cli/credentials with the content:

PORKBUN_API_KEY=<api-key>
PORKBUN_SECRET_API_KEY<secret-api-key>

Examples

./porkbun-cli.sh \
  --api-key pk_1234 \
  --secret-api-key sk_1234 -- \
  retrieve example.com
./porkbun-cli.sh -- \
  create example.com www \
  --type A \
  --content 1.1.1.1
./porkbun-cli.sh -- \
  edit example.com 1234567890 \
  --type A \
  --name www \
  --content 1.1.1.1
  • Edit record by domain, subdomain, and type (reference)
./porkbun-cli.sh -- \
  edit-by-name-type example.com www \
  --type A \
  --content 1.1.1.1
./porkbun-cli.sh -- \
  delete example.com 1234567890
  • Delete record by domain, subdomain, and type (reference)
./porkbun-cli.sh -- \
  delete-by-name-type example.com www \
  --type A
./porkbun-cli.sh -- \
  retrieve example.com
  • Retrieve records by domain and id (reference)
./porkbun-cli.sh -- \
  retrieve example.com 1234567890
  • Upsert record by domain
# if no records exist for this domain, subdomain, type, then create it
# if one record exists for this domain, subdomain, type, then update it
# otherwise, error unless --multiple-behavior is set (see below)
./porkbun-cli.sh -- \
  upsert-by-name-type example.com www \
  --type A \
  --content 1.1.1.1
  • Uniquely upsert record by domain
# if no records exist for this domain, subdomain, type, then create it
# if one record exists for this domain, subdomain, type, then update it
# otherwise, delete all records for this domain, subdomain, type and then
# create a new record
./porkbun-cli.sh -- \
  upsert-by-name-type example.com www \
  --type A \
  --content 1.1.1.1 \
  --multiple-behavior unique
  • Append upsert record by domain
# if no records exist for this domain, subdomain, type, then create it
# if one record exists for this domain, subdomain, type, then update it
# otherwise, append a new record
./porkbun-cli.sh -- \
  upsert-by-name-type example.com www \
  --type A \
  --content 1.1.1.1 \
  --multiple-behavior append

About

A tiny shell script for interacting with the Porkbun API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages