Command options:
config:set [--scope="..."] [--scope-code="..."] [-l|--lock] path value
where
-
--scopeis the scope of configuration (default,website, orstore) (default value isdefault) -
--scope-codeis the scope code of configuration (website code or store view code) -
-l|--lockprevents a configuration value from being changed in the Magento Admin -
pathis configuration path (required) -
valueis value of configuration (required)
Set configuration values that can be edited in the Magento Admin
Use magento config:set without -l|-lock to write the value to the database. Values you set this way can be edited in the Magento Admin.
Some examples for setting a store base URL follow:
Example to set the base URL for the default scope:
bin/magento config:set web/unsecure/base_url http://example.com
Example to set the base URL for the base website:
bin/magento config:set --scope=websites --scope-code=base web/unsecure/base_url http://example2.com
Example to set the base URL for the test store view:
bin/magento config:set --scope=stores --scope-code=test web/unsecure/base_url http://example3.com
Set configuration values that cannot be edited in the Magento Admin
If you use the -l|--lock option as follows, the configuration value is saved in config.php and the field for editing this value in Admin page is disabled.
bin/magento config:set --lock --scope=stores --scope-code=default web/unsecure/base_url http://example3.com
If you use the -l|--lock option:
-
Configuration values are saved in
<Magento base dir>/app/etc/config.phpTransfer
config.phpto another system to use the same configuration values there. For example, if you have a testing system, using the sameconfig.phpmeans you don’t have to set the same configuration values again. -
Configuration values cannot be edited in the Admin.
-
You can use
-l|-lockto set configuration values if Magento is not installed. However, you can set values only for the default scope.
In case of wrong configuration path, this command returns an error
The "wrong/config/path" does not exist