I’m trying to use the Magento2 config:sensitive:set
CLI command to set a sensitive configuration value, but Magento is throwing the following error:
There are no sensitive configurations to fill
I’ve already searched the web, came across one Magento stackexchange question, and another one, as well as a Magento2 GitHub issue, but none of the suggested answers worked for me.
Saving via the admin panel works fine, I’m looking to make use of the core Magento config:sensitive:set
CLI command.
The field is defined as obscure
, it’s added to MagentoConfigModelConfigTypePool
as sensitive
, and also the backend model assigned in config.xml
:
system.xml
file:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="tax">
<group id="my_custom_group" translate="label" sortOrder="150" showInDefault="1" showInWebsite="1" showInStore="0">
<field id="my_field" translate="label" type="obscure" sortOrder="300" showInDefault="1" showInWebsite="1" showInStore="0">
<label>some label</label>
<backend_model>MagentoConfigModelConfigBackendEncrypted</backend_model>
</field>
</group>
</section>
</system>
</config>
di.xml
file:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoConfigModelConfigTypePool">
<arguments>
<argument name="sensitive" xsi:type="array">
<item name="tax/my_custom_group/my_field" xsi:type="string">1</item>
</argument>
</arguments>
</type>
</config>
config.xml
file:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<tax>
<my_custom_group>
<my_field backend_model="MagentoConfigModelConfigBackendEncrypted"/>
</my_custom_group>
</tax>
</default>
</config>
Anyone got this working??