Skip to content

Introduce config.local.php for local configuration overrides#205

Merged
pentium10 merged 2 commits intoptrofimov:masterfrom
pentium10:master
Apr 10, 2025
Merged

Introduce config.local.php for local configuration overrides#205
pentium10 merged 2 commits intoptrofimov:masterfrom
pentium10:master

Conversation

@pentium10
Copy link
Copy Markdown
Collaborator

Problem:

Users need to modify config.php for their specific local development environment (e.g., server addresses, authentication). However, config.php is 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.php file:

  1. Introduce config.local.php: Users can now create a config.local.php file in the same directory as config.php. This file is intended for local overrides.
  2. Modify config.php Loading Logic:
    • config.php now checks for the existence of config.local.php.
    • If config.local.php exists and is readable, it is required, and its configuration replaces the default configuration defined later in config.php.
    • The application version number from the original config.php is preserved even when config.local.php is loaded.
  3. Add Instructions: Clear instructions have been added to the top of config.php explaining how to use config.local.php.
  4. Basic Validation: A simple check (count($GLOBALS['config'], true) < 16) is included to die() if config.local.php seems to be missing expected configuration options, prompting the user to update it.

How to Use:

  1. Create a new file named config.local.php in the same directory as config.php.
  2. Copy the entire $GLOBALS['config'] = array(...) structure from the bottom of config.php into config.local.php.
  3. Modify the values within config.local.php according 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.

@pentium10 pentium10 merged commit c785e5c into ptrofimov:master Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant