diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..1c70495 --- /dev/null +++ b/README.md @@ -0,0 +1,75 @@ +# Namecheap CLI + +A quick script to list/add/remove/update DNS records for a Namecheap managed domain. It does not use any non-standard Go libraries. + +## Why + +At the time of writing, there is no simple way to add DNS records for my Namecheap domain from the cli, since strictly "adding" is not supported. Instead, we have to first get all the current records and include the new one as part of the [setHosts](https://www.namecheap.com/support/api/methods/domains-dns/set-hosts/) method. This would involve a bunch of XML parsing which is beyond my bash-fu. + +## Pre-Requisites + +You must setup an API Access Key, and whitelist your access IP. Follow instructions for [Enabling API Access](https://www.namecheap.com/support/api/intro/). + +## Usage + +Available sub-commands: +* `list`: show all DNS records currently configured. +* `add`: add a DNS record. +* `update`: update an existing DNS record. +* `remove`: remove existing DNS record(s). You will be prompted for which record(s) you want to remove. + +### Docker + +```bash +docker run --rm -it --name nctest \ + -e API_USER="[ your namecheap user ]" + -e API_KEY="[ your namecheap api access key ]" + -e ACCESS_IP="[ your namecheap api whitelisted IP ]" + -e DOMAIN_MAIN="[ your namecheap managed domain ]" + -e DOMAIN_END="[ your namecheap managed domain's ending (net, or com, or xyz etc.) ]" + registry.gitlab.com/kdam0/nccli:[your architecture] + /bin/nccli add -h +``` +Outputs: +```bash +Usage of add: + -name string + Name of DNS record. + -priority int + Value of the DNS record. + -ttl int + TTL of the DNS record. (default 1800) + -type string + Type of DNS record. + -v Verbosity. More output. Default=false. + -value string + Value of the DNS record. +``` +Images are available for the following architectures: +* linux/amd64 +* linux/arm32v7 + +### Non-Docker +1. Create `nccli.env` file with content: +```bash +API_USER="[ your namecheap user ]" +API_KEY="[ your namecheap api access key ]" +ACCESS_IP="[ your namecheap api whitelisted IP ]" +DOMAIN_MAIN="[ your namecheap managed domain ]" +DOMAIN_END="[ your namecheap managed domain's ending (net, or com, or xyz etc.) ]" +``` + +2. Build: +```bash +go build nccli.go +``` + +3. Activate env: +```bash +source nccli.env +``` + +4. Run: +```bash +./nccli -h +``` |
