This repository contains the code for a program that updates your domain's DNS on GoDaddy and Freenom based on your current IP. The motivation was to help updating the domain DNS in home servers, with dynamic ISP IPs. It was made in a way that, with the help of a job scheduler such as CRON, it will run in a given time frame on your server to check for its current public IP, compare with the last IP logged and, in case of change, update the DNS registry for your domains.
-
Environment variables (
.env
)The
example.env
file needs to be renamed to simply.env
and edited:- GoDaddy API key and secret. You can get yours here.
# API key
GD_KEY=''
# API secret
GD_SEC=''
- Freenom user credentials. The same ones used to log into your account.
# User email
FN_USER=''
# User password
FN_PSWD=''
- Telegram BOT token and chat id. Learn how to create or find yours here.
# BOT token
TG_TOKEN=''
# Chat ID
TG_CHATID=''
-
Configuration file (
config.json
)The
example.config.json
file needs to be renamed to simplyconfig.json
and edited:- Both JSON's
godaddy
andfreenom
keys have an object as their values. The keys of these objects need to be your domain names with its TLD for each domain plataform. Their values are an array containing the subdomains you want to update. There are special subdomains@
for no subdomain (e.g.domain.com
) and*
for the wildcard subdomains (i.e. any subdomain under that domain). The wildcard subdomain can only be used with GoDaddy domains. - In the
example.config.json
, there is the configuration for updatingexample.com
domain (registered at GoDaddy) for its root (example.com
itself) its wildcard subdomains (*.example.com
) andsubdomain.example.com
. Also, there is the configuration for updatingexample.tk
(registered at Freenom) for its root (example.tk
itself), and bothwww.example.tk
andsubdomain.example.tk
subdomains.
- Both JSON's