Skip to main content
OCLC Support

IncludeFile

Learn how to use the IncludeFile config.txt directive to allow EZproxy to open a specified file and use it to configure EZproxy.

IncludeFile is a config.txt directive that tells EZproxy to read and apply the contents of another file as if it were part of the main config.txt. These included files can contain any config.txt directives, including additional IncludeFile lines. However, a file can only be included once, and EZproxy prevents looping errors (e.g., File 1 includes File 2, which includes File 1).

 Note: If the filename specified by IncludeFile is not readable by EZproxy at startup, then EZproxy will fail to start. Please refer to messages.txt for log messages about IncludeFile failures.

Examples

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 https://www.somedb.com
HJ www.somedatabase.com
DJ somedatabase.com
Find NAME="_PRIORREFERER" VALUE="https://
Replace NAME="_PRIORREFERER" VALUE="https://^A
IncludeFile generated.cfg

and the sample generated.cfg might look like:

Title OtherDatabase
URL https://www.otherdatabase.com
HJ www.otherdatabase.com
DJ otherdatabase.com
Title AnotherDatabase.com
URL https://www.anotherdatabase.com
HJ www.anotherdatabse.com
DJ anotherdatabase.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 https://ezp1.yourlib.org/
HAPeer https://ezp2.yourlib.org/

and have the specific.cfg contain system-specific lines such as:


Name ezp1.yourlib.org
Interface 68.14.229.197

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.

Related directives

HAName, HAPeer