Introduce config.local.php for local configuration overrides#205
Merged
pentium10 merged 2 commits intoptrofimov:masterfrom Apr 10, 2025
Merged
Introduce config.local.php for local configuration overrides#205pentium10 merged 2 commits intoptrofimov:masterfrom
pentium10 merged 2 commits intoptrofimov:masterfrom
Conversation
Merge pull request ptrofimov#204 from pentium10/master
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
Users need to modify
config.phpfor their specific local development environment (e.g., server addresses, authentication). However,config.phpis tracked by Git, leading to local changes being overwritten during updates (git pull) or causing merge conflicts.Solution:
This PR introduces a mechanism to separate local configuration from the main, tracked
config.phpfile:config.local.php: Users can now create aconfig.local.phpfile in the same directory asconfig.php. This file is intended for local overrides.config.phpLoading Logic:config.phpnow checks for the existence ofconfig.local.php.config.local.phpexists and is readable, it isrequired, and its configuration replaces the default configuration defined later inconfig.php.config.phpis preserved even whenconfig.local.phpis loaded.config.phpexplaining how to useconfig.local.php.count($GLOBALS['config'], true) < 16) is included todie()ifconfig.local.phpseems to be missing expected configuration options, prompting the user to update it.How to Use:
config.local.phpin the same directory asconfig.php.$GLOBALS['config'] = array(...)structure from the bottom ofconfig.phpintoconfig.local.php.config.local.phpaccording to your local environment needs (servers, auth, storage path, etc.).This change allows users to maintain their local settings without modifying the tracked
config.php, resolving the issue of overwritten configurations during updates.