# -*- text -*-
##
## templates.conf -- configurations to be used in multiple places
##
##	$Id$

######################################################################
#
#  Version 2.0 has a useful new feature called "templates".
#
#  Use templates by adding a line in radiusd.conf:
#
#	$INCLUDE templates.conf
#
#  The goal of the templates is to have common configuration located
#  in this file, and to list only the *differences* in the individual
#  sections.  This feature is most useful for sections like "clients"
#  or "home_servers", where many may be defined, and each one has
#  similar repeated configuration.
#
#  Something similar to templates can be done by putting common
#  configuration into separate files, and using "$INCLUDE file...",
#  but this is more flexible, and simpler to understand.  It's also
#  cheaper for the server, because "$INCLUDE" makes a copy of the
#  configuration for inclusion, and templates are simply referenced.
#
#  The templates are defined in the "templates" section, so that they
#  do not affect the rest of the server configuration.
#
#  A section can reference a template by using "$template name"
#
templates {
	  #
	  #  The contents of the templates section are other
	  #  configuration sections that would normally go into
	  #  the configuration files.
	  #

	  #
	  #  This is a default template for the "home_server" section.
	  #  Note that there is no name for the section.
	  #
	  #  Any configuration item that is valid for a "home_server"
	  #  section is also valid here.  When a "home_server" section
	  #  is defined in proxy.conf, this section is referenced as
	  #  the template.
	  #
	  #  Configuration items that are explicitly listed in a
	  #  "home_server" section of proxy.conf are used in
	  #  preference to the configuration items listed here.
	  #
	  #  However, if a configuration item is NOT listed in a
	  #  "home_server" section of proxy.conf, then the value here
	  #  is used.
	  #
	  #  This functionality lets you put common configuration into
	  #  a template, and to put only the unique configuration
	  #  items in "proxy.conf".  Each section in proxy.conf can
	  #  then contain a line "$template home_server", which will
	  #  cause it to reference this template.
	  #
	  home_server {
		      	response_window = 20
			zombie_period = 40
			revive_interval = 120
			#
			#  Etc.
	  }

	  #
	  #  You can also have named templates.  For example, if you
	  #  are proxying to 3 different home servers all at the same
	  #  site, with identical configurations (other than IP
	  #  addresses), you can use this named template.
	  #

	  #  Then, each "home_server" section in "proxy.conf" would
	  #  only list the IP address of that home server, and a
	  #  line saying
	  #
	  #		$template example_com
	  #
	  #  That would tell FreeRADIUS to look in the section below
	  #  for the rest of the configuration items.
	  #
	  #  For various reasons, you shouldn't have a "." in the template
	  #  name.  Doing so means that the server will be unable to find
	  #  the template.
	  #
	  example_com {
		      type = auth
		      port = 1812
		      secret = testing123
		      response_window = 20
		      #
		      # Etc...
	  }

	  #
	  #  You can have templates for other sections, too, but they
	  #  seem to be most useful for home_servers.
	  #
	  #  For now, you can use templates only for sections in
	  #  radiusd.conf, not sub-sections.  So you still have to use
	  #  the "$INCLUDE file.." method for things like defining
	  #  multiple "sql" modules, each with similar configuration.
	  #	  
}
