I'd like to read and use the information stored in my env.php to my js files. Is there an entity that I can use to fix this?
1 Answer
Anil, this really bad idea to fetch the data directly from env.php
and It break the security of Magento.
I don't know why you need this but you have to build your logic another way without reading env.php and So that Magento security WILL NOT break.
Also, php is the server-side language and where the js is client language if you want to read the data from php then you have to store data at json varaible to your browser.
-
HI @amit Bera, Actually we have some files which are apart from the Magento files as per our project requirement. I'm trying to call site Url in both PHP and js files. So I cannot access the Object manager as these files are not Magento.– anilJan 8, 2019 at 8:36