-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Support for Traditional conf.php Style (Bracket Notation with Comments)
Current Behavior
PhpConfigFile currently uses var_export() to write configuration, which generates modern array syntax:
$conf = array (
'use_ssl' => 2,
'server' =>
array (
'name' => NULL,
),
);Requested Feature
Support writing configuration in the traditional Horde conf.php.dist style with bracket notation and inline comments:
// Determines how we generate full URLs (for location headers and
// such). Possible values are:
// 0 - Assume that we are not using SSL and never generate https URLS.
// 1 - Assume that we are using SSL and always generate https URLS.
// NOTE: If you do this, you MUST hardcode the correct HTTPS port
// number in $conf['server']['port'] below. Otherwise Horde will
// be unable to generate correct HTTPS URLs when a user tries to
// access Horde via a non-HTTPS port.
// 2 - Attempt to auto-detect, and generate URLs appropriately.
$conf['use_ssl'] = 2;
// What server name should we use? You'll probably know if you need to
// change this default; only in situations where you need to override
// what Apache thinks the server name is.
$conf['server']['name'] = $_SERVER['SERVER_NAME'];Use Case
The traditional style:
- Is more human-readable for configuration files
- Allows inline documentation comments explaining each setting
- Preserves the style established in Horde's distribution files
- Makes diffs more readable when updating configuration
Proposed API
$file = new PhpConfigFile(
configFilePath: $confFile,
style: 'bracket', // or 'var_export' (default)
header: '/* CONFIG START */',
footer: '/* CONFIG END */'
);Alternative Approach
If full bracket notation support is complex, even preserving comments from the original file when updating values would be valuable.
Related
This came up while developing hordectl configuration management tools that need to maintain compatibility with existing Horde configuration file styles.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels