IncludeFile is a position-independent config.txt directive that tells EZproxy to open the specified file and use it to configure EZproxy as though its contents were part of the main config.txt file. The additional files called and processed with the IncludeFile directive can contain any config.txt directives including additional IncludeFile lines. There are limits on the number of times a file referenced in an IncludeFile line can be called, a file can only be included once (EZproxy will process the file the first time it encounters it), and EZproxy has safeguarded against IncludeFile loop errors (e.g., IncludeFile 1 references IncludeFile 2 which references IncludeFile 1).
Generated configuration example
For those sites that use programs to generate their database definitions, IncludeFile provides a convenient way to intermix the general EZproxy configuration directives, database-specific directives, and generated directives. A sample config.txt might look like:
Name ezproxy.yourlib.org LoginPort 80
Title Some Database with special configuration need URL http://www.somedb.com D somedb.com Find NAME="_PRIORREFERER" VALUE="http:// Replace NAME="_PRIORREFERER" VALUE="http://^A IncludeFile generated.cfg
and the sample generated.cfg might look like:
Title http://www.otherdb.com URL http://www.otherdb.com D otherdb.com
Title http://www.anotherdb.com URL http://www.anotherdb.com D another.db.com
Separating the hand-edited config.txt from the computer-produced generated.cfg reduces the chance of losing special configuration options and also simplifies overriding generated configuration with manually specified configuration, since the first database definition in config.txt or one of its included files defines the behavior for that database, overriding any similar entries that appear later in the configuration.
High Availability Configuration Example
If you use the HAName and HAPeer directives to create High Availability configuration of EZproxy, the bulk of config.txt is identical on all servers. The only difference should be the Name directive and any Interface directives. To simplify maintenance, you can setup config.txt like this:
IncludeFile specific.cfg HAName shared.yourlib.org HAPeer http://ezp1.yourlib.org:2048/ HAPeer http://ezp2.yourlib.org:2048/
and have the specific.cfg contain system-specific lines such as:
Name ezp1.yourlib.org Interface 22.214.171.124
With this setup, you can copy config.txt to all servers as you make changes without any need to modify the file for each server to changes its Name directive.