-
Notifications
You must be signed in to change notification settings - Fork 2
DNS
Expensive can set and unset DNS host records when using Namecheap DNS service. This is ideal for dev-ops engineers native to CLI environment who want to avoid having to click through the web-interface.
This is the list of all possible arguments which can be used to manipulate DNS hosts.
| Argument | Short | Description |
|---|---|---|
| --record | The record type. Can be one of the following:
A, AAAA, ALIAS, CAA, CNAME, MX, MXE,
NS, TXT, URL, URL301, FRAME. |
|
| --TXT | -TXT | Add a TXT record with this address to the domain.
Alias for --record TXT --address . |
| --A | -A | Add an A record with this address to the domain.
Alias for --record A --address . |
| --CNAME | -CNAME | Add a CNAME record with this address to the domain.
--record CNAME --address . |
| --ttl | When adding host records, sets the TTL. By default, namecheap sets 1800. | |
| --host | The host name for adding dns records. Default @. |
|
| --address | The address of the new host record. | |
| --mxpref | MX preference for hosts. Applicable to MX records only. | |
| --github | -g | Setup GitHub pages for the apex domain as per docs https://git.io/fjyr7 Also removes the parking page and URL redirect. All other hosts are kept itact. |
| --delete | -d | Remove the specified host record. |
To create a TXT record, there's the TXT alias, which set the type TXT and address equal to the value of the passed argument.
expensive expensive-demo.com --TXT github-wikiGetting current hostsSetting 4 host records
Successfully set { RecordType: 'TXT', Address: 'github-wiki', HostName: '@' } on expensive-demo.com. Fetching updated hosts
Name Type Address TTL www CNAME parkingpage.namecheap.com. 1800 @ TXT google-site-verification=YtZVj7zCv0Xf 4rPmon2wB0bxWXshKmgKq8dL8WgRXV4 1800 @ TXT github-wiki 1800 @ URL http://www.expensive-demo.com?from=@ 1800
To delete a record, the --delete flag should be set. All other arguments must be set to match the record being deleted. If, for example, only the --record A is passed without the --address, Expensive will remove all host records of type A.
wiki~:$ expensive expensive-demo.com --TXT github-wiki --deleteGetting current hostsAre you sure you want to unset { RecordType: 'TXT', Address: 'github-wiki', HostName: '@' } (y/n): [y] y Setting 3 host records
Successfully deleted { RecordType: 'TXT', Address: 'github-wiki', HostName: '@' } on expensive-demo.com. Fetching updated hosts
Name Type Address TTL www CNAME parkingpage.namecheap.com. 1800 @ TXT google-site-verification=YtZVj7zCv0Xf 4rPmon2wB0bxWXshKmgKq8dL8WgRXV4 1800 @ URL http://www.expensive-demo.com?from=@ 1800
The example shows how to set the AAAA record with a given TTL for the www subdomain (host):
wiki:~$ expensive expensive-demo.com --record AAAA --address 10.10.10.10 --ttl 3600 --host wwwGetting current hostsSetting 4 host records
Successfully set { RecordType: 'AAAA', Address: '10.10.10.10', HostName: 'www', TTL: '3600' } on expensive-demo.com. Fetching updated hosts
Name Type Address TTL www AAAA 10.10.10.10 3600 www CNAME parkingpage.namecheap.com. 1800 @ TXT google-site-verification=YtZVj7zCv0Xf 4rPmon2wB0bxWXshKmgKq8dL8WgRXV4 1800 @ URL http://www.expensive-demo.com?from=@ 1800
Unsetting the record is performed in the same way, but by adding the -d option:
wiki:~$ expensive expensive-demo.com --record AAAA --address 10.10.10.10 --ttl 3600 -dGetting current hostsAre you sure you want to unset { RecordType: 'AAAA', Address: '10.10.10.10', HostName: 'www', TTL: '3600' } (y/n): [y] y Setting 3 host records
Successfully deleted { RecordType: 'AAAA', Address: '10.10.10.10', HostName: 'www', TTL: '3600' } on expensive-demo.com. Fetching updated hosts
Name Type Address TTL www CNAME parkingpage.namecheap.com. 1800 @ TXT google-site-verification=YtZVj7zCv0Xf 4rPmon2wB0bxWXshKmgKq8dL8WgRXV4 1800 @ URL http://www.expensive-demo.com?from=@ 1800
