Git Product home page Git Product logo

cloudflare-ddns's Introduction

Dynamic DNS

Updates a given a DNS record with your current IP

Example with the Cloudflare provider:

docker run \
  -e PROVIDER=cloudflare \
  -e CLOUDFLARE_APITOKEN=YOUR_API_TOKEN \
  -e CLOUDFLARE_ZONEID=YOUR_ZONE_ID \
  -e CLOUDFLARE_HOST=YOUR_DOMAIN \
  hugomd/cloudflare-ddns:2.0.0

Example running as a persistant daemon:

docker run -d --restart always \
  -e PROVIDER=cloudflare \
  -e CLOUDFLARE_APITOKEN=YOUR_API_TOKEN \
  -e CLOUDFLARE_ZONEID=YOUR_ZONE_ID \
  -e CLOUDFLARE_HOST=YOUR_DOMAIN \
  hugomd/cloudflare-ddns:2.0.0 -duration 2h

You can load environment variables through a config file of key/value pairs.

echo "PROVIDER=YOUR_PROVIDER" > config.env
docker run \
  -v $PWD/config.env:/tmp/config.env \
  hugomd/cloudflare-ddns -config /tmp/config.env

A note about Docker image tags: latest currently points to a now deprecated version of cloudflare-ddns, please use versioned tags e.g. hugomd/cloudflare-ddns:2.0.0.

Supported Providers

Provider Reference (used for PROVIDER environment variable)
Cloudflare cloudflare

CLI

Parameter Description Example Required
-duration Runs program perpetually and recheck after specified interval; parses time strings such as 5m, 15m, 2h30m5s. If not specified, or if equal to 0s, run once and exit. 2h false
-config Loads environment variables from a given file. Variables should be specified as lines of key=value pairs. No variables will be loaded if a file is not specified. /tmp/config.env false

Environment Variables

All providers require the following environment variable:

Environment Variable Description Example Required
PROVIDER The name of the provider you wish to use cloudflare true

Cloudflare

Environment Variable Description Example Required
CLOUDFLARE_APITOKEN An API Token, with permission to edit DNS records for your zone 12345 true
CLOUDFLARE_ZONEID The Zone ID of your domain in Cloudflare (you can find this in the "Overview" tab at the bottom of the page) dd255baaaaad2e8... true
CLOUDFLARE_HOST The record you want to update subdomain.example.com true
CLOUDFLARE_ZONE DEPRECATED Cloudflare Zone example.com
CLOUDFLARE_EMAIL DEPRECATED Email associated with your Cloudflare account [email protected]
CLOUDFLARE_APIKEY DEPRECATED Cloudflare API key 12345

Deprecated Environment Variables

Cloudflare now supports API tokens as a more secure way of interacting with their API. Instead of using your global API key/email, you should use a token with limited permissions.

When upgrading, you'll need to replace a few existing environment variables.

Instead of providing a CLOUDFLARE_ZONE with your domain name, you should specify the Zone ID (CLOUDFLARE_ZONEID) of your domain. You can find this in the "Overview" tab for your domain.

Instead of your CLOUDFLARE_EMAIL and CLOUDFLARE_APIKEY, you should generate a token (CLOUDFLARE_APITOKEN) with permission to edit DNS records for your desired zone.

You don't need to make any changes to your CLOUDFLARE_HOST.

Contributing

Adding a new provider

To add a new provider:

  1. Create a new folder in lib/providers, called your_provider
  2. Create a package for your provider in the previously created folder, your_provider.
  3. Ensure your provider implements the Provider interface
  4. Import your provider in lib/providers/_all/all.go
  5. Open a PR ๐ŸŽ‰

License

MIT, see LICENSE.

cloudflare-ddns's People

Contributors

analogist avatar hugomd avatar nchlswhttkr avatar stek29 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.