Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 1, 2025

The config:store:get command previously only read configuration values from the core_config_data database table, missing values that were overridden in env.php, config.php, or XML default configuration files. This led to displaying incorrect or outdated values when configuration was managed through these files instead of the database.

Problem

When Magento configuration is stored in deployment files (config.php), environment files (env.php), or defined in XML defaults, the config:store:get command would show stale database values instead of the actual effective configuration that Magento uses at runtime.

Solution

Enhanced the command using a hybrid approach that:

  1. Preserves wildcard functionality: Still uses the existing database collection query to find matching config paths (supporting patterns like '%yotpo%', 'admin/*', etc.)

  2. Gets accurate values: For each found path, uses ScopeConfigInterface::getValue() to retrieve the actual effective configuration value from all sources

  3. Proper scope mapping: Maps database scope names ('websites', 'stores') to ScopeConfigInterface scope names ('website', 'store')

  4. Maintains full compatibility: All existing functionality preserved (formatting options, filtering, output modes, etc.)

Configuration Priority Order

The command now correctly follows Magento's configuration priority:

  1. XML default configuration files (lowest priority)
  2. config.php (deployment configuration)
  3. env.php (environment configuration)
  4. Database (core_config_data table - highest priority)

Example Use Cases

# Shows actual session_lifetime from env.php, not outdated database value
magerun2 config:store:get admin/security/session_lifetime

# Find all Yotpo config with real effective values  
magerun2 config:store:get '%yotpo%'

# Get all admin configs with accurate values from all sources
magerun2 config:store:get 'admin/*'

This resolves the issue where users couldn't trust the command output when configuration was stored in env.php or config.php files.

Fixes #712.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@cmuench
Copy link
Member

cmuench commented Aug 1, 2025

@copilot try it again

- Use ConfigReaderTrait and ScopeConfigInterface to get actual effective values
- Add scope mapping between database scopes and ScopeConfigInterface scopes
- Preserve wildcard functionality using hybrid approach
- Add comprehensive documentation explaining the enhancement
- Add test case to validate the new functionality
- Maintain full backward compatibility

This resolves the issue where config:store:get only read from database and
missed values overridden in env.php, config.php, or XML default files.

Co-authored-by: cmuench <[email protected]>
Copy link
Contributor Author

Copilot AI commented Aug 1, 2025

@copilot try it again

I've implemented the enhancement to config:store:get that resolves the issue. The command now reads from all configuration sources (env.php, config.php, XML defaults, and database) using a hybrid approach:

  • Uses database collection for wildcard path matching (preserving existing functionality)
  • Uses ScopeConfigInterface to get actual effective values from all sources
  • Added proper scope mapping between database and config scopes
  • Maintained full backward compatibility
  • Added comprehensive documentation and test coverage

The implementation is complete in commit 1bd9a2d.

Copilot AI changed the title [WIP] config:store:get does not read config.php or env.php, or default xml Enhance config:store:get to read from all configuration sources Aug 1, 2025
Copilot finished work on behalf of cmuench August 1, 2025 16:26
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.

config:store:get does not read config.php or env.php, or default xml

2 participants