aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2019-01-06 03:41:47 +0000
committerGravatar Yong Tang <yong.tang.github@outlook.com> 2019-01-05 19:41:47 -0800
commitfb32f7a3587a598b4296e1bc36b611306e843468 (patch)
tree7b7676fd7ffe9d5bf9c3df393fc814d74d9a400a /plugin
parent652b9a69d852ca22565676b99be16bd93359d145 (diff)
downloadcoredns-fb32f7a3587a598b4296e1bc36b611306e843468.tar.gz
coredns-fb32f7a3587a598b4296e1bc36b611306e843468.tar.zst
coredns-fb32f7a3587a598b4296e1bc36b611306e843468.zip
Add import plugin to give it docs (#2428)
* wip: add import to make it have docs Fake the import plugin further to give it proper docs. This should help make it more discoverable. Signed-off-by: Miek Gieben <miek@miek.nl> * Finish writing the documentation Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'plugin')
-rw-r--r--plugin/import/import.md73
1 files changed, 73 insertions, 0 deletions
diff --git a/plugin/import/import.md b/plugin/import/import.md
new file mode 100644
index 000000000..7e34097db
--- /dev/null
+++ b/plugin/import/import.md
@@ -0,0 +1,73 @@
+# import
+
+## Name
+
+*import* - include files or reference snippets from a Corefile.
+
+## Description
+
+The *import* plugin can be used to incude files into the main configuration. Another use it to
+reference predefined snippets. Both can help to avoid some duplication.
+
+This is a unique directive in that *import* can appear outside of a server block. In other words, it
+can appear at the top of a Corefile where an address would normally be.
+
+## Syntax
+
+~~~
+import PATTERN
+~~~
+
+* **PATTERN** is the file, glob pattern (`*`) or snippet to include. Its contents will replace
+ this line, as if that file's contents appeared here to begin with.
+
+## Files
+
+You can use *import* to include a file or files. This file's location is relative to the
+Corefile's location. It is an error if a specific file cannot be found, but an empty glob pattern is
+not an error.
+
+## Snippets
+
+You can define snippets to be reused later in your Corefile by defining a block with a single-token
+label surrounded by parentheses:
+
+~~~ corefile
+(mysnippet) {
+ ...
+}
+~~~
+
+Then you can invoke the snippet with *import*:
+
+~~~
+import mysnippet
+~~~
+
+## Examples
+
+Import a shared configuration:
+
+~~~
+. {
+ import config/common.conf
+}
+~~~
+
+Where `config/common.conf` contains:
+
+~~~
+prometheus
+errors
+log
+~~~
+
+This imports files found in the zones directory:
+
+~~~
+import ../zones/*
+~~~
+
+## Also See
+
+See corefile(5).