0

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 1

1

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.

1
  • 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.
    – anil
    Jan 8, 2019 at 8:36

Your Answer

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

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