{"id":15640283,"url":"https://github.com/lmammino/godaddy-dns","last_synced_at":"2025-04-30T13:39:12.583Z","repository":{"id":57153514,"uuid":"58415755","full_name":"lmammino/godaddy-dns","owner":"lmammino","description":"A Node.js script to programmatically update GoDaddy DNS records","archived":false,"fork":false,"pushed_at":"2024-05-24T18:25:52.000Z","size":405,"stargazers_count":78,"open_issues_count":13,"forks_count":21,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-01-02T16:13:47.641Z","etag":null,"topics":["command","command-line","dns","godaddy","godaddy-account","godaddy-api","godaddy-dns-records","node","nodejs","secret"],"latest_commit_sha":null,"homepage":"https://lmammino.github.io/godaddy-dns/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lmammino.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-09T23:52:57.000Z","updated_at":"2024-05-22T10:20:00.000Z","dependencies_parsed_at":"2024-06-19T17:35:07.948Z","dependency_job_id":"4f007d55-1452-4469-b25d-5e825fdf56bd","html_url":"https://github.com/lmammino/godaddy-dns","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmammino%2Fgodaddy-dns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmammino%2Fgodaddy-dns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmammino%2Fgodaddy-dns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmammino%2Fgodaddy-dns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lmammino","download_url":"https://codeload.github.com/lmammino/godaddy-dns/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233265462,"owners_count":18650037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command","command-line","dns","godaddy","godaddy-account","godaddy-api","godaddy-dns-records","node","nodejs","secret"],"created_at":"2024-10-03T11:33:32.701Z","updated_at":"2025-01-09T22:11:03.661Z","avatar_url":"https://github.com/lmammino.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# godaddy-dns\n\nA Node.js script to programmatically update GoDaddy DNS records\n\n[![npm version](https://badge.fury.io/js/godaddy-dns.svg)](http://badge.fury.io/js/godaddy-dns)\n[![CircleCI](https://circleci.com/gh/lmammino/godaddy-dns.svg?style=shield)](https://circleci.com/gh/lmammino/godaddy-dns)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n---\n\n## Introduction\n\nThis Node.js script allows you to programmatically update one or more GoDaddy DNS\nrecords inserting the public IP of the machine where the script is run.\n\nQuick example:\n\n```bash\ngodaddy-dns -c config.json\n```\n\n\n## Requirements\n\nThis script requires **Node.js** (version \u003e= 6.0.0) and a valid GoDaddy API **key**\nand **secret**. You can get register a new key on your [GoDaddy developer page](https://developer.godaddy.com/keys/)\n\n\n## Installation\n\nTo install the script globally you can use NPM:\n\n```bash\nnpm install --global godaddy-dns\n```\n\n*If you have the script already installed in your system, this command will\nupdate it to the latest available version.*\n\nAfter executing this command the script `godaddy-dns` will be globally available\nin your system. Give it a try with:\n\n```bash\ngodaddy-dns -V\n```\n\n\n### Binaries\n\nFrom version 1.1.0, you can also install godaddy-dns by simply downloading the binary executable file for your operative system in the [Releases](https://github.com/lmammino/godaddy-dns/releases) section.\n\n\n## Configuration\n\nThe command needs a configuration file in order to be executed. The configuration\nfile can be specified at runtime using the option `--config`, if not specfied the\ncommand will try to access the file `.godaddy-dns.json` in the home directory of\nthe current user.\n\nThe configuration file contains a JSON object with the following fields:\n\n  * **apiKey**: The API key for your GoDaddy account\n  * **secret**: The API key secret for your GoDaddy account\n  * **domain**: The domain for which to update the DNS records\n  * **records**: An array of objects that defines the records to update. Every\n  record object can define the following values:\n   * **name**: (mandatory) the name of the record (e.g. `\"mysubdomain\"`, `\"@\"` or `\"*\"`)\n   * **type**: (default `\"A\"`) the type of entry for the record\n   * **ttl**: (default `600`) the TTL of the record in seconds (min value is 600)\n\nYou can define the DNS records in the **records** configuration also using a shorter\nsyntax by just passing the **name** of the domain as a plain string (e.g. `\"mysubdomain\"`).\nIf you have a single record wrapping it into an array is optional, you can\nsimply pass it as a single string or object.\n\nSee [config.json.sample](config.json.sample) for an example of how to structure\nyour `config.json`.\n\n\n## Update multiple domains\n\nIf you need to update multiple domains you can use the option `domain` in the records array as in the following configuration example:\n\n```json\n{\n  \"apiKey\": \"\",\n  \"secret\": \"\",\n  \"domain\": \"example.com\",\n  \"records\": [\n    {\"type\": \"A\", \"name\": \"mysubdomain\", \"ttl\": 600},\n    {\"domain\":\"my-other-domain.com\", \"type\": \"A\", \"name\": \"subdomain2\", \"ttl\": 600} //overrides main domain name (example.com)\n  ]\n}\n```\n\nIn this example, everytime a new IP is detected the following domains will be updated:\n\n - `mysubdomain.example.com`\n - `subdomain2.my-other-domain.com`\n\n\n## Last IP cache\n\nTo avoid to send useless requests to the GoDaddy API (e.g. when the IP is not\nchanged) the script stores the last public ip sent to GoDaddy in a cache file.\nThis file is by default stored in the default OS temp folder with the name `.lastip`.\nYou can use a custom location for this file with the option `--ipFile`.\nIf you want to clear this cache (and force a new request to the GoDaddy API) you\ncan simply delete this file.\n\n\n## Running the script continuously with Cron\n\nOne of the principal use cases why you might want to use this script (and actually\nmy original motivation to create it) is to map a DNS record to a machine with a\nnon-static IP. This way you can recreate your home-made DynamicDNS solution.\n\nIn this scenario you might want to add an entry to your Cron configuration as\nin the following example:\n\n```\n*/5 * * * * godaddy-dns \u003e /var/log/godaddy-dns.log 2\u003e\u00261\n```\n\nIn this case the script will be executed every 5 minutes and the logs will be stored\nin `/var/logs/godaddy-dns.log`. Also note that in this example you will use the\ndefault configuration file location. If you want to specify a different location\nuse the option `--config`.\n\n\n## Command line options\n\n```\nUsage: godaddy-dns [options]\n\n  Options:\n\n    -h, --help           output usage information\n    -V, --version        output the version number\n    -c, --config [file]  specify the configuration file to use  (default \"\u003cuser home folder\u003e/.godaddy-dns.json\")\n    -i, --ipfile [file]  specify which file to use to store the last found ip (default \"\u003cuser temp folder\u003e/.lastip\")\n```\n\n\n## Programmatic usage\n\nIf you want to use the features of this module in a Node.js project:\n\n```javascript\nconst dns = require(\"godaddy-dns\");\n\ndns.getCurrentIp().then((currentIp)=\u003e{\n  console.log(\"Current ip\",currentIp);\n\n  dns.updateRecords(currentIp,{\n    \"apiKey\": \"\",\n    \"secret\": \"\",\n    \"domain\": \"example.com\",\n    \"records\": [\n      {\"type\": \"A\", \"name\": \"@\", \"ttl\": 600}\n    ]\n  })\n  .then(() =\u003e {\n    console.log(`[${new Date()}] Successfully updated DNS records to ip ${currentIp}`)\n  })\n  .catch((err) =\u003e {\n    if (err \u0026\u0026 err.message !== 'Nothing to update') {\n      console.error(`[${new Date()}] ${err}`)\n      process.exit(1)\n    }\n  });\n});\n```\n\nThanks [@aandrulis](https://github.com/aandrulis) for suggesting to expose this.\n\n\n## Bugs and improvements\n\nIf you find a bug or have an idea about how to improve this script you can [open an issue](https://github.com/lmammino/godaddy-dns/issues) or [submit a pull request](https://github.com/lmammino/godaddy-dns/pulls), it will definitely make you a better person! 😝\n\n\n## License\n\nLicensed under [MIT License](LICENSE). © Luciano Mammino.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flmammino%2Fgodaddy-dns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flmammino%2Fgodaddy-dns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flmammino%2Fgodaddy-dns/lists"}