mirror of
https://github.com/coredns/coredns.git
synced 2025-12-04 17:35:13 -05:00
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>
This commit is contained in:
@@ -39,6 +39,8 @@ Comments may be started anywhere on a line.
|
|||||||
Environment variables are supported and either the Unix or Windows form may be used: `{$ENV_VAR_1}`
|
Environment variables are supported and either the Unix or Windows form may be used: `{$ENV_VAR_1}`
|
||||||
or `{%ENV_VAR_2%}`.
|
or `{%ENV_VAR_2%}`.
|
||||||
|
|
||||||
|
You can use the `import` "plugin" to include parts of other files.
|
||||||
|
|
||||||
If CoreDNS can’t find a Corefile to load it loads the following builtin one:
|
If CoreDNS can’t find a Corefile to load it loads the following builtin one:
|
||||||
|
|
||||||
~~~ corefile
|
~~~ corefile
|
||||||
@@ -49,8 +51,7 @@ If CoreDNS can’t find a Corefile to load it loads the following builtin one:
|
|||||||
|
|
||||||
## Import
|
## Import
|
||||||
|
|
||||||
You can use the `import` "plugin" to include parts of other files, see <https://coredns.io/explugins/import>.
|
You can use the `import` "plugin" to include parts of other files, see <https://coredns.io/plugins/import>.
|
||||||
This is enabled by default.
|
|
||||||
|
|
||||||
## Snippets
|
## Snippets
|
||||||
|
|
||||||
@@ -133,3 +134,4 @@ Apache License 2.0
|
|||||||
## See Also
|
## See Also
|
||||||
|
|
||||||
The manual page for CoreDNS: coredns(1) and more documentation on <https://coredns.io>.
|
The manual page for CoreDNS: coredns(1) and more documentation on <https://coredns.io>.
|
||||||
|
Also see the [*import*](https://coredns.io/plugins/import)'s documentation.
|
||||||
|
|||||||
73
plugin/import/import.md
Normal file
73
plugin/import/import.md
Normal file
@@ -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).
|
||||||
Reference in New Issue
Block a user