2022-04-16 21:04:35 +03:00
|
|
|
# piglet
|
|
|
|
|
2022-12-18 01:42:39 +03:00
|
|
|
**piglet** is a [Porkbun DNS API](https://porkbun.com/api/json/v3/documentation)
|
|
|
|
CLI client.
|
2022-04-16 21:04:35 +03:00
|
|
|
|
2022-12-18 01:42:39 +03:00
|
|
|
Currently **piglet** can:
|
2022-04-16 21:04:35 +03:00
|
|
|
|
|
|
|
- Create a DNS record
|
|
|
|
- Edit record
|
|
|
|
- Delete DNS record
|
|
|
|
- Retrieve DNS records
|
|
|
|
|
|
|
|
# Installation
|
|
|
|
|
2022-12-18 01:42:39 +03:00
|
|
|
1. Clone this Git-repository.
|
|
|
|
2. Install files.
|
|
|
|
|
|
|
|
Installation with Makefile:
|
2022-04-16 21:04:35 +03:00
|
|
|
|
|
|
|
```sh
|
2022-12-18 01:42:39 +03:00
|
|
|
# System-wide installation
|
|
|
|
sudo make install
|
|
|
|
# Local installation (into user's home dir)
|
|
|
|
PREFIX=~/.local make install
|
2022-04-16 21:04:35 +03:00
|
|
|
```
|
|
|
|
|
2022-12-18 01:42:39 +03:00
|
|
|
Manual installation:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
# Just copy files into your PATH, for example:
|
|
|
|
sudo install -Dm755 piglet /usr/local/bin/piglet
|
|
|
|
sudo install -Dm644 completion.bash /usr/share/bash-completion/completions/piglet
|
|
|
|
```
|
|
|
|
|
|
|
|
Make sure your shell loads files from `/usr/local/share/bash-completion/completions`
|
|
|
|
or `~/.local/share/bash-completion/completions` for Bash completion.
|
|
|
|
|
|
|
|
Add to your **~/.bashrc**:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
for completion in {/usr/local,~/.local}/share/bash-completion/completions/*; do
|
|
|
|
[ -f "$completion" ] && . "$completion"
|
|
|
|
done
|
|
|
|
```
|
|
|
|
|
|
|
|
Create file `~/.config/piglet/domains.list` with your domains list (each domain on
|
|
|
|
new line) for complete domains names. For example:
|
|
|
|
|
|
|
|
```
|
|
|
|
example.com
|
|
|
|
another-domain.tld
|
|
|
|
```
|
2022-04-16 21:04:35 +03:00
|
|
|
|
|
|
|
# Getting started
|
|
|
|
|
|
|
|
For first step setup the configuration file:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
piglet config
|
|
|
|
```
|
|
|
|
|
2022-12-18 01:42:39 +03:00
|
|
|
piglet creates `~/.config/piglet/piglet.conf` file with API credentials.
|
2022-04-16 21:04:35 +03:00
|
|
|
|
|
|
|
Retrieve DNS records:
|
|
|
|
|
|
|
|
```sh
|
2022-12-18 01:42:39 +03:00
|
|
|
piglet retrieve example.com
|
2022-04-16 21:04:35 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
Create A-record on subdomain `mail`:
|
|
|
|
|
|
|
|
```sh
|
2022-12-18 01:42:39 +03:00
|
|
|
piglet create mail.example.com type=a content=127.0.0.1 ttl=3600
|
2022-04-16 21:04:35 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
Edit A-record for `example.org` (change to 127.0.0.1):
|
|
|
|
|
|
|
|
```sh
|
2022-12-18 01:42:39 +03:00
|
|
|
piglet edit example.org id=220755500 type=a content=127.0.0.1
|
2022-04-16 21:04:35 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
Delete DNS record by id:
|
|
|
|
|
|
|
|
```sh
|
2022-12-18 01:42:39 +03:00
|
|
|
piglet delete example.org id=220755592
|
2022-04-16 21:04:35 +03:00
|
|
|
```
|
|
|
|
|
2022-12-18 01:42:39 +03:00
|
|
|
See **piglet --help** for more info.
|