mirror of
				https://github.com/coredns/coredns.git
				synced 2025-11-03 02:33:21 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			111 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Groff
		
	
	
	
	
	
			
		
		
	
	
			111 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Groff
		
	
	
	
	
	
.\" Generated by Mmark Markdown Processer - mmark.miek.nl
 | 
						|
.TH "COREDNS-IMPORT" 7 "March 2021" "CoreDNS" "CoreDNS Plugins"
 | 
						|
 | 
						|
.SH "NAME"
 | 
						|
.PP
 | 
						|
\fIimport\fP - includes files or references snippets from a Corefile.
 | 
						|
 | 
						|
.SH "DESCRIPTION"
 | 
						|
.PP
 | 
						|
The \fIimport\fP plugin can be used to include files into the main configuration. Another use is to
 | 
						|
reference predefined snippets. Both can help to avoid some duplication.
 | 
						|
 | 
						|
.PP
 | 
						|
This is a unique plugin in that \fIimport\fP 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.
 | 
						|
 | 
						|
.SH "SYNTAX"
 | 
						|
.PP
 | 
						|
.RS
 | 
						|
 | 
						|
.nf
 | 
						|
import PATTERN
 | 
						|
 | 
						|
.fi
 | 
						|
.RE
 | 
						|
 | 
						|
.IP \(bu 4
 | 
						|
\fBPATTERN\fP is the file, glob pattern (\fB\fC*\fR) or snippet to include. Its contents will replace
 | 
						|
this line, as if that file's contents appeared here to begin with.
 | 
						|
 | 
						|
 | 
						|
.SH "FILES"
 | 
						|
.PP
 | 
						|
You can use \fIimport\fP 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.
 | 
						|
 | 
						|
.SH "SNIPPETS"
 | 
						|
.PP
 | 
						|
You can define snippets to be reused later in your Corefile by defining a block with a single-token
 | 
						|
label surrounded by parentheses:
 | 
						|
 | 
						|
.PP
 | 
						|
.RS
 | 
						|
 | 
						|
.nf
 | 
						|
(mysnippet) {
 | 
						|
    ...
 | 
						|
}
 | 
						|
 | 
						|
.fi
 | 
						|
.RE
 | 
						|
 | 
						|
.PP
 | 
						|
Then you can invoke the snippet with \fIimport\fP:
 | 
						|
 | 
						|
.PP
 | 
						|
.RS
 | 
						|
 | 
						|
.nf
 | 
						|
import mysnippet
 | 
						|
 | 
						|
.fi
 | 
						|
.RE
 | 
						|
 | 
						|
.SH "EXAMPLES"
 | 
						|
.PP
 | 
						|
Import a shared configuration:
 | 
						|
 | 
						|
.PP
 | 
						|
.RS
 | 
						|
 | 
						|
.nf
 | 
						|
\&. {
 | 
						|
   import config/common.conf
 | 
						|
}
 | 
						|
 | 
						|
.fi
 | 
						|
.RE
 | 
						|
 | 
						|
.PP
 | 
						|
Where \fB\fCconfig/common.conf\fR contains:
 | 
						|
 | 
						|
.PP
 | 
						|
.RS
 | 
						|
 | 
						|
.nf
 | 
						|
prometheus
 | 
						|
errors
 | 
						|
log
 | 
						|
 | 
						|
.fi
 | 
						|
.RE
 | 
						|
 | 
						|
.PP
 | 
						|
This imports files found in the zones directory:
 | 
						|
 | 
						|
.PP
 | 
						|
.RS
 | 
						|
 | 
						|
.nf
 | 
						|
import ../zones/*
 | 
						|
 | 
						|
.fi
 | 
						|
.RE
 | 
						|
 | 
						|
.SH "SEE ALSO"
 | 
						|
.PP
 | 
						|
See corefile(5).
 | 
						|
 |