cancel
Showing results for 
Search instead for 
Did you mean: 

Add service contract API to set system configuration values

0 Kudos

Add service contract API to set system configuration values

Feature request from Vinai, posted on GitHub Apr 07, 2016

Before going through the work to create a PR, I wanted to ask if this feature maybe already is being developed internally.

More details:
Currently there is no service contract API to manage the system configuration in the core_config_data table.

I am aware of the \Magento\Store\Api\StoreConfigManagerInterface and \Magento\Store\Api\Data\StoreConfigInterface, but having a more generic interface to build extensions to help with deployment and provisioning of dev systems would be very useful.

Currently the only way to do that I have found was to use direct SQL inserts into the table, or use \Magento\Config\Model\Config directly. In addition to not being blessed with an @api annotation, the public interface isn't easy to use with the PHP array it uses.

What I would like to have in the to be added service contract API would be a data object with a scope, scope_id, path and value. And a repository to save and get them.

So if this isn't already part of an internal task and you think it is a good idea, please give me a go ahead.

7 Comments
apiuser
New Member
Status changed to: Investigating
 
apiuser
New Member

Comment from adragus-inviqa, posted on GitHub Apr 07, 2016

having a more generic interface to build extensions to help with deployment and provisioning of dev systems would be very useful

Could you give us some examples of that?

apiuser
New Member

Comment from Vinai, posted on GitHub Apr 07, 2016

Sure. For example, just a few days ago I would have liked to add a little command to bin/magento like

bin/magento system:config:set system/full_page_cache/caching_application 2 (enable varnish FPC) I also was looking for a way to set sandbox values for payment modules on an integration host in a similar fashion.

Another useful application is setting system config values in setup scripts, so they are applied automatically with a module.
In Magento 1 there was \Mage_Core_Model_Resource_Setup::setConfigData(), but that didn't make it into Magento 2 it seems. At least none of the interfaces inheriting \Magento\Framework\Setup\SetupInterface have it.

apiuser
New Member

Comment from mazhalai, posted on GitHub Apr 11, 2016

@Vinai Thank you for reporting, we have created MAGETWO-51781 to investigate and fix.

apiuser
New Member

Comment from adragus-inviqa, posted on GitHub Apr 24, 2016

Is Magento\Framework\App\Config\Storage\WriterInterface of any help?

apiuser
New Member

Comment from Vinai, posted on GitHub Jun 18, 2016

@adragus-inviqa That interface would be perfect if it had a @api annotation. Thanks!

apiuser
New Member

Comment from andimov, posted on GitHub Jul 11, 2016

According to contributor guide, tickets without response for two weeks should be closed. Please feel free to reopen if it's needed.