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?
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.