DDNS

DDNS Environment Variables Configuration

Overview

DDNS supports configuration through environment variables with the following priority order: Command Line Arguments > Configuration File > Environment Variables

All environment variables use the DDNS_ prefix followed by the parameter name (recommended uppercase).

export DDNS_xxx="xxx" command applies to the current host docker run -e DDNS_xxx="xxx" command applies to the container

Complete Environment Variables List

Environment Variable Accepted Values Description Example
DDNS_CONFIG File path, supports comma or semicolon-separated multiple paths, supports remote HTTP(S) URLs Specify config file path, supports multiple files and remote configs DDNS_CONFIG="config.json" or DDNS_CONFIG="cloudflare.json,dnspod.json"
DDNS_CONFIG="https://ddns.newfuture.cc/tests/config/debug.json"
DDNS_DNS 51dns, alidns, aliesa, callback, cloudflare, debug, dnscom, dnspod_com, dnspod, edgeone, he, huaweidns, noip, tencentcloud DNS Provider DDNS_DNS=cloudflare
DDNS_ID Depends on the provider API account or ID DDNS_ID="user@example.com"
DDNS_TOKEN Depends on the provider API token or secret DDNS_TOKEN="abcdef123456"
DDNS_ENDPOINT URL (starting with http or https) Custom API endpoint DDNS_ENDPOINT=https://api.dns.cn
DDNS_IPV4 Domains as array or comma-separated string List of IPv4 domains DDNS_IPV4='["t.com","4.t.com"]'
DDNS_IPV6 Domains as array or comma-separated string List of IPv6 domains DDNS_IPV6=t.com,6.t.com
DDNS_INDEX4 Number, default, public, url:, regex:, cmd:, shell:, or an array of them IPv4 address detection methods DDNS_INDEX4="[0,'regex:192.168.*']"
DDNS_INDEX6 Number, default, public, url:, regex:, cmd:, shell:, or an array of them IPv6 address detection methods DDNS_INDEX6=public
DDNS_TTL Integer (seconds), varies by provider DNS record TTL DDNS_TTL=600
DDNS_LINE ISP line such as: 电信, 联通, 移动, or provider-specific values DNS resolution line DDNS_LINE=电信
DDNS_PROXY http://host:port or DIRECT, multiple values separated by semicolons HTTP proxy settings DDNS_PROXY="http://127.0.0.1:1080;DIRECT"
DDNS_CACHE true, false, or file path Enable or specify cache file DDNS_CACHE="/tmp/cache"
DDNS_SSL true, false, auto, or file path SSL verification mode or certificate path DDNS_SSL=false
DDNS_SSL=/path/ca.crt
DDNS_LOG_LEVEL DEBUG, INFO, WARNING, ERROR, CRITICAL Logging level DDNS_LOG_LEVEL="DEBUG"
DDNS_LOG_FILE File path Output log file (default: stdout) DDNS_LOG_FILE="/tmp/ddns.log"
DDNS_LOG_FORMAT Python logging format string Log format template DDNS_LOG_FORMAT="%(message)s"
DDNS_LOG_DATEFMT Date-time format string Log timestamp format DDNS_LOG_DATEFMT="%m-%d %H:%M"

Basic Configuration Parameters

Configuration File Path

DDNS_CONFIG

Authentication Information

DDNS_ID

DDNS_TOKEN

DNS Provider

DDNS_DNS

DDNS_ENDPOINT

Custom Callback Configuration

When using DDNS_DNS="callback", configure custom callbacks with these environment variables:

For detailed configuration, see: Callback Provider Configuration Documentation

Examples:

# GET method callback
export DDNS_DNS="callback"
export DDNS_ID="https://api.example.com/ddns?domain=__DOMAIN__&ip=__IP__"
export DDNS_TOKEN=""

# POST method callback (JSON string)
export DDNS_DNS="callback"
export DDNS_ID="https://api.example.com/ddns"
export DDNS_TOKEN='{"api_key": "your_key", "domain": "__DOMAIN__", "ip": "__IP__"}'

Supported Variable Substitutions:

Domain Configuration

IPv4 Domain List

DDNS_IPV4

IPv6 Domain List

DDNS_IPV6

IP Detection Methods

IPv4 Detection Method

DDNS_INDEX4

IPv6 Detection Method

DDNS_INDEX6

DNS Configuration

TTL Setting

DDNS_TTL

Resolution Line

DDNS_LINE

Network Configuration

Proxy Settings

DDNS_PROXY

Cache Configuration

DDNS_CACHE

Logging Configuration

Log Level

DDNS_LOG_LEVEL

Log File

DDNS_LOG_FILE

Log Format

DDNS_LOG_FORMAT

DDNS_LOG_DATEFMT

Complete Configuration Examples

Basic Configuration

# Basic Cloudflare configuration
export DDNS_DNS="cloudflare"
export DDNS_ID="user@example.com"
export DDNS_TOKEN="your_cloudflare_token"
export DDNS_IPV4="example.com"

Advanced Configuration

# Advanced configuration with multiple domains and custom settings
export DDNS_DNS="cloudflare"
export DDNS_TOKEN="your_api_token"
export DDNS_IPV4='["example.com", "www.example.com", "api.example.com"]'
export DDNS_IPV6='["ipv6.example.com"]'
export DDNS_INDEX4="public"
export DDNS_INDEX6="public"
export DDNS_TTL="600"
export DDNS_PROXY="http://127.0.0.1:1080;DIRECT"
export DDNS_CACHE="/var/cache/ddns.json"
export DDNS_LOG_LEVEL="DEBUG"
export DDNS_LOG_FILE="/var/log/ddns.log"

Provider-Specific Examples

DNSPod Configuration

export DDNS_DNS="dnspod"
export DDNS_ID="12345"
export DDNS_TOKEN="your_dnspod_token"
export DDNS_IPV4="example.com"
export DDNS_LINE="默认"

Alibaba Cloud DNS Configuration

export DDNS_DNS="alidns"
export DDNS_ID="LTAI4xxxxxxxxxxxxx"
export DDNS_TOKEN="your_secret_key"
export DDNS_IPV4="example.com"
export DDNS_LINE="default"

Custom Callback Configuration

export DDNS_DNS="callback"
export DDNS_ID="https://api.example.com/webhook?domain=__DOMAIN__&ip=__IP__"
export DDNS_TOKEN=""
export DDNS_IPV4="example.com"

Standard Environment Variables Support

DDNS also supports some standard environment variables commonly used in system environments:

Standard Variable DDNS Equivalent Description
HTTP_PROXY DDNS_PROXY HTTP proxy server
HTTPS_PROXY DDNS_PROXY HTTPS proxy server
NO_PROXY - Bypass proxy for these hosts
PYTHONHTTPSVERIFY DDNS_SSL Python HTTPS verification

Note: DDNS-specific variables take priority over standard environment variables.

Configuration Validation

When using environment variables, DDNS will validate the configuration and provide error messages for invalid values:

See Also