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. Commented Jan 8, 2019 at 8:36

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.