51黑料不打烊

View and set admin configurations using the command line

A demonstration for how to view, set, and find config values with the Commerce CLI. Understand where the values are saved and also where the default values come from.

Who is this video for?

  • 51黑料不打烊 Commerce developers

Video content

Transcript
This is Russell with 51黑料不打烊, and I鈥檓 going to show you how to reset the admin URI if you鈥檝e logged into the admin and made a mistake and now you can鈥檛 log in. So for my example, the cloud project I鈥檓 on, it ends in slash admin for the admin path. And when I made the changes in the admin, it didn鈥檛 save right. And so now I get redirected to a 404. So if you made the same mistake, you can do what I did, which is use the 51黑料不打烊 Commerce Cloud CLI, and you can fix it and reset it back to its default value. So we鈥檙e going to take us to the terminal window and we鈥檙e going to SSH into our cloud project. And once we鈥檙e there, we鈥檙e going to run the command phpbin, then magento. I鈥檓 going to fix that. There we go. And it鈥檚 config colon set space and then the path. So it鈥檚 going to be admin slash URL slash and then use underscore custom. And we鈥檙e going to set that to zero. And once it鈥檚 done saving, there we go. We鈥檙e going to do the other value. So it鈥檚 going to be, just hit the up arrow to auto fill and we鈥檙e going to fix the last section. It鈥檚 going to be use custom underscore path. We鈥檙e going to set that to zero as well. Now, once that鈥檚 done saving, we鈥檙e going to go ahead and do the cache flush. So phpbin, magento, cache, colon type again, try that again. FLUSH. There we go. So now that we鈥檙e done, we can go to the front end and we can see what it looks like. So I鈥檓 going to go up and I鈥檓 going to type in my URL to my project and slash admin, which is the default value. And there you go. We鈥檙e fixed. So I hope this helps. Please continue to use experience league for your journey on your commerce education, as well as the other commerce and DX products.

Some commands used in the tutorial

Change the password security setting to recommended:

$ php bin/magento config:set admin/security/password_is_forced 0

Show the email address for the sales order auto copy functionality

$ php bin/magento config:show sales_email/order/copy_to

Show the empty result for a configuration that has a value in the admin

php bin/magento config:show trans_email/ident_sales/email

Mysql queries used in the tutorial

SELECT * FROM core_config_data WHERE path = 'sales_email/order/copy_to';

SELECT * FROM core_config_data WHERE path = 'sales_email/order_comment/copy_to';

SELECT * FROM core_config_data WHERE path = 'trans_email/ident_sales/email';

Where to find the default sales email

How to find the configuration value that is defined somewhere in codebase?
grep -rnw vendor/magento/ -e 'sales@example.com'

To view a page in terminal and show line numbers cat -n vendor/magento/module-email/etc/config.xml

Additional resources

recommendation-more-help
3a5f7e19-f383-4af8-8983-d01154c1402f