4

you may know that a store configuration value can be set from terminal using this command

php bin/magento config:set web/secure/base_url http://127.0.0.1/magento/

But today I came accross a situation where I had to reset the value for a configuration or if I say in database terms to set the value of configuration to null in core_config_data table.

Does anybody know how is that possible from terminal?

2 Answers 2

2

I was able to do so by passing an empty string:

php bin/magento config:set recaptcha_frontend/type_for/customer_login ""

It sets it to NULL in the database.

It doesn't work for the path web/secure/base_url, though; you'll get a validation error.

0

You can't save NULL url related configuration from terminal

php bin/magento config:set web/secure/base_url NULL

If you will run above command then it will give you below error :

Invalid Secure Base URL. Value must be a URL or one of placeholders: {{base_url}},{{unsecure_base_url}}

This error occured because :

File : vendor/magento/module-config/Model/Config/Backend/Baseurl.php

private function _isFullyQualifiedUrl($value)
{
    return preg_match('/\/$/', $value) && $this->getUrlValidator()->isValid($value, ['http', 'https']);
}

Above function check your url should be start with http or https and end with /

If you want to set NULL base url then you must be set null value directly from database

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.