diff --git a/docs/_providers/cloudflare.md b/docs/_providers/cloudflare.md index b98a55f44..246816f98 100644 --- a/docs/_providers/cloudflare.md +++ b/docs/_providers/cloudflare.md @@ -22,57 +22,72 @@ username and access token: ## Metadata Record level metadata availible: - * cloudflare_proxy ("on", "off", or "full") + * cloudflare_proxy ('on', 'off', or 'full') Domain level metadata availible: - * cloudflare_proxy_default ("on", "off", or "full") + * cloudflare_proxy_default ('on', 'off', or 'full') Provider level metadata availible: * ip_conversions -Note: Aliases are pre-defined as follows: +What does on/off/full mean? + + * "off" disables the Cloudflare proxy + * "on" enables the Cloudflare proxy (turns on the "orange cloud") + * "full" is the same as "on" but also enables Railgun. DNSControl will prevent you from accidentally enabling "full" on a CNAME that points to an A record that is set to "off", as this is generally not desired. + +**Aliases:** + +To make configuration files more readable and less prone to typos, +the following aliases are pre-defined: {% highlight json %} -var CF_PROXY_OFF = {'cloudflare_proxy': 'off'}; // Default/off. -var CF_PROXY_ON = {'cloudflare_proxy': 'on'}; // Sites safe to proxy. -var CF_PROXY_FULL = {'cloudflare_proxy': 'full'}; // Sites safe to railgun. -var SET_PROXY_DEFAULT_TRUE = CF_PROXY_ON; // Turn on CF proxy for entire domain. -var SET_PROXY_DEFAULT_FALSE = CF_PROXY_OFF; // basically a no-op. +// Meta settings for individual records. +var CF_PROXY_OFF = {'cloudflare_proxy': 'off'}; // Proxy disabled. +var CF_PROXY_ON = {'cloudflare_proxy': 'on'}; // Proxy enabled. +var CF_PROXY_FULL = {'cloudflare_proxy': 'full'}; // Proxy+Railgun enabled. +// Per-domain meta settings: +// Proxy default off for entire domain (the default): +var CF_PROXY_DEFAULT_OFF = {'cloudflare_proxy_default': 'off'}; +// Proxy default on for entire domain: +var CF_PROXY_DEFAULT_ON = {'cloudflare_proxy_default': 'on'}; {% endhighlight %} -Thus metadata items can be used in a more readable way: +The following example shows how to set meta variables with and without aliases: {% highlight json %} -D("example.tld", REG_NAMECOM, DnsProvider(CFLARE), - A("www1","1.2.3.11", CF_PROXY_ON), - A("www2","1.2.3.12", CF_PROXY_OFF), // default is OFF, this is a no-op. +D('example.tld', REG_NAMECOM, DnsProvider(CFLARE), + A('www1','1.2.3.11', CF_PROXY_ON), // turn proxy ON. + A('www2','1.2.3.12', CF_PROXY_OFF), // default is OFF, this is a no-op. + A('www3','1.2.3.13', {'cloudflare_proxy': 'on'}) // why would anyone do this? ); {% endhighlight %} -or simply: - -{% highlight json %} -D("example.tld", REG_NAMECOM, DnsProvider(CFLARE), - SET_PROXY_DEFAULT_TRUE, // Enable CF proxy for all items: - A("www1","1.2.3.11"), - A("www2","1.2.3.12"), - A("www3","1.2.3.13", CF_PROXY_OFF), // Except this one! -); -{% endhighlight %} - - ## Usage Example javascript: {% highlight js %} -var REG_NAMECOM = NewRegistrar("name.com","NAMEDOTCOM"); -var CFLARE = NewDnsProvider("cloudflare.com","CLOUDFLAREAPI"); +var REG_NAMECOM = NewRegistrar('name.com','NAMEDOTCOM'); +var CFLARE = NewDnsProvider('cloudflare.com','CLOUDFLAREAPI'); -D("example.tld", REG_NAMECOM, DnsProvider(CFLARE), - A("test","1.2.3.4"), - A("www","1.2.3.4", {cloudlfare_proxy:"on"}), - ALIAS("@","test.example.tld",{cloudflare_proxy:"on"}) +// Example domain where the CF proxy abides by the default (off). +D('example.tld', REG_NAMECOM, DnsProvider(CFLARE), + A('proxied','1.2.3.4', CF_PROXY_ON), + A('notproxied','1.2.3.5'), + A('another','1.2.3.6', CF_PROXY_ON), + ALIAS('@','www.example.tld.', CF_PROXY_ON), + CNAME('myalias','www.example.tld.', CF_PROXY_ON) +); + +// Example domain where the CF proxy default is set to "on": +D('example2.tld', REG_NAMECOM, DnsProvider(CFLARE), + CF_PROXY_DEFAULT_ON, // Enable CF proxy for all items unless otherwise noted. + A('proxied','1.2.3.4'), + A('notproxied','1.2.3.5', CF_PROXY_OFF), + A('another','1.2.3.6'), + ALIAS('@','www.example2.tld.'), + CNAME('myalias','www.example2.tld.') ); {%endhighlight%} @@ -84,5 +99,4 @@ DNSControl depends on a Cloudflare Global API Key that's available under "My Set If a domain does not exist in your CloudFlare account, DNSControl will *not* automatically add it. You'll need to do that via the -control panel manually or via the command `dnscontrol create-domains` --command. +control panel manually or via the `dnscontrol create-domains` command.