About Features Downloads Getting Started Documentation Events Support GitHub

Love VuFind®? Consider becoming a financial supporter. Your support helps build a better VuFind®!

Site Tools


Warning: This page has not been updated in over over a year and may be outdated or deprecated.
configuration:inheritance

Configuration File Inheritance

VuFind® allows a configuration file to inherit settings from a parent configuration. Different configuration file types have slightly different inheritance options as described below.

Inheritance in .ini Files

.ini files do not have any implicit inheritance, but you can define several options in the [Parent_Config] section of a file to make it inherit settings from a parent file. See the [Parent_Config] section in config/vufind/config.ini for details.

Inheritance in .yaml Files

By default a .yaml file inherits top-level sections from the corresponding base configuration file in config/vufind if they don't exist.

For example, if the base configuration contains the following settings:

AllFields:
  DismaxFields:
    - allfields
    - fulltext

Author:
  DismaxFields:
    - author
  DismaxHandler: dismax  

ISN:
  DismaxFields:
    - isbn

And the local configuration contains the following settings:

Author:
  DismaxFields:
    - author2
  DismaxHandler: edismax  

Coordinate:
  DismaxFields:
    - long_lat_display

The result is the equivalent of:

AllFields:
  DismaxFields:
    - allfields
    - fulltext

Author:
  DismaxFields:
    - author2
  DismaxHandler: edismax  

Coordinate:
  DismaxFields:
    - long_lat_display

ISN:
  DismaxFields:
    - isbn

You can specify another file to inherit from with a `“@parent_yaml”: “parentfile.yaml”` directive at the top of the local yaml file. The file name can be an absolute path or a relative path.

Merging Sections in .yaml Files

Starting with VuFind® 9.0 you can also define sections that should be merged together at the top level or a sub-level by using the `“@merge_sections”` directive. This directive should contain an array of paths, where each path is an array starting from the top level down to the desired level. For example assuming the parent config above and the local config below:

"@merge_sections":
  - [Author, DismaxFields]

Author:
  DismaxFields:
    - author2

Coordinate:
  DismaxFields:
    - long_lat_display

The result is the equivalent of:

AllFields:
  DismaxFields:
    - allfields
    - fulltext

Author:
  DismaxFields:
    - author
    - author2
  DismaxHandler: edismax  

Coordinate:
  DismaxFields:
    - long_lat_display

ISN:
  DismaxFields:
    - isbn

Inheritance of Entire Configuration Directories

Starting with VuFind® 9.1, you can use DirLocations.ini to chain together a series of local settings directories. This can be useful in combination with file-based inheritance to solve various configuration organization problems.

configuration/inheritance.txt · Last modified: 2023/07/18 13:40 by demiankatz