Skip to content

silkscreencms-contrib/config_layered

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Layered Configuration Driver (config_layered)

This driver contains the Layered configuration driver for Silkscreen CMS.

To enable this driver, place it in the drivers directory in the root of the Silkscreen CMS site or in the sites/[yoursite]/drivers directory.

This configuration storage driver combines several configuration objects in a stack. When reading configuration data, the driver starts and the top of the stack and searches each configuration object until the requested setting is found. When writing, the driver starts at the top of the stack and looks for the first mutable object, and writes the configuration there.

To configure this, first setup the various layers according to each driver's directions. Then, create the layered configuration referencing the other layers. The prefix for layered configuration URLs is layered.

For example:

// Define a memory-based config object and a file-based config object.
$config_directories['memory'] = 'mem:mem_config';
$config_directories['active_files'] = 'file://files/config/active';

// Now layer the two.
$config_directories['active'] = 'layered:/memory/active_files';

// Create some memory configurations. (i.e., overrides.)
$settings['config']['mem_config'] = array(
  'system.core' => array(
    'site_name' => 'Overridden Site Name',
  ),
);

With this setup, config_get('system.core', 'site_name') will read from the memory configuration object, but since the memory-based configuration object is immutable, config_set('system.core', 'site_name') will go to the active_files configuration object.

License

This project is GPL v2 software. See the LICENSE.txt file in this directory for complete text.

Maintainers

About

Layered configuration storage driver

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages