-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Add option "lock-config" for shell command "config:set" #13280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option "lock-config" for shell command "config:set" #13280
Conversation
This is similar to the "lock" switch which writes configuration values to app/etc/env.php. The "share" switch writes it to app/etc/config.php instead which can be shared between environments.
…hare option We are using Virtual Classes now as we have almost the same Processor twice and we can avoid having duplicate code this way.
The "getOption" method was called more often than before, so we had to adjust that.
This new method contains the new parameter and will be called from the old method.
This is similar to the "lock" switch which writes configuration values to app/etc/env.php. The "share" switch writes it to app/etc/config.php instead which can be shared between environments.
…hare option We are using Virtual Classes now as we have almost the same Processor twice and we can avoid having duplicate code this way.
The "getOption" method was called more often than before, so we had to adjust that.
This new method contains the new parameter and will be called from the old method.
…g-set-option-share # Conflicts: # app/code/Magento/Deploy/Model/Mode.php
|
@avstudnitz really great pr, read your article about it a while ago |
|
@davidverholen I just had that in a training last week, and I can confirm that the original |
|
@avstudnitz Ok, I think I know now what happened. I was just confused since I used this command to generate the config.php, but did not recognize the values being written to the env.php Actually, I've set up everything with config:set and then exported the configuration to the config.php with bin/magento app:config:dump. The app:config:dump command seems to make a difference between env specific and env independent settings. So some settings are considered shared and these are dumped to the config.php. I'm still searching for this Flag, my first guess was in the system.xml. For example the base_url is configured in my local env.php, but is not exported to the config.php. Even if I explicitly lock the base_url before the config:dump. Most other settings are exported to the config.php. |
|
@davidverholen Ah, yes. Some configuration options are marked as "sensitive" and not exported into config.php. See https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Config/etc/di.xml#L313-L324 for how it can be set. |
|
@fooman @okorshenko Any info when this will be tackled? It was almost finished in old PR #12178. |
|
@avstudnitz thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository. |
|
@magento-engcom-team Done. |
- fixed backward compatibility
Taken over from #12178.
This is similar to the "lock" switch which writes configuration
values to app/etc/env.php. The "lock-config" switch writes it to
app/etc/config.php instead which can be shared between environments.
For consistency, the "lock" switch has been renamed to "lock-env".
Description
In most cases, configuration settings should be shared among all development, staging and live instances of a shop. To achieve this, you can use the same mechanism as with the
--lockswitch described in http://devdocs.magento.com/guides/v2.2/config-guide/cli/config-cli-subcommands-config-mgmt-set.html.The only difference is that the configuration values will be stored in app/etc/config.php instead of app/etc/env.php. This file should usually be included in the VCS and thus shared between instances.
To store a config setting in the file via command line, the command would be as follows:
i.e.
Manual testing scenarios
bin/magento config:set --lock-config general/store_information/name "Sample Store"from the command lineContribution checklist