From 5166d9ddb5ac4a7e65c335c3d4bfa4a0b106b1b1 Mon Sep 17 00:00:00 2001 From: Chris O'Haver Date: Fri, 25 Feb 2022 15:24:33 -0500 Subject: [PATCH] briefly doc env vars and import substitution (#5207) Signed-off-by: Chris O'Haver --- README.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 803e6554e..99e2aae0b 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ on port `53` and enables `whoami` plugin is: ~~~ Sometimes port number 53 is occupied by system processes. In that case you can start the CoreDNS server -while modifying the Corefile as given below so that the CoreDNS server starts on port 1053. +while modifying the `Corefile` as given below so that the CoreDNS server starts on port 1053. ~~~ corefile .:1053 { @@ -118,9 +118,29 @@ while modifying the Corefile as given below so that the CoreDNS server starts on } ~~~ -If you have a Corefile without a port number specified it will, by default, use port 53, but you can +If you have a `Corefile` without a port number specified it will, by default, use port 53, but you can override the port with the `-dns.port` flag: `coredns -dns.port 1053`, runs the server on port 1053. +You may import other text files into the `Corefile` using the _import_ directive. You can use globs to match multiple +files with a single _import_ directive. + +~~~ txt +.:53 { + import example1.txt +} +import example2.txt +~~~ + +You can use environment variables in the `Corefile` with `{$VARIABLE}`. Note that each environment variable is inserted +into the `Corefile` as a single token. For example, an environment variable with a space in it will be treated as a single +token, not as two separate tokens. + +~~~ txt +.:53 { + {$ENV_VAR} +} +~~~ + A Corefile for a CoreDNS server that forward any queries to an upstream DNS (e.g., `8.8.8.8`) is as follows: ~~~ corefile