Magento 2. Retrieve information from env.php in the js files programmatically The Next CEO of...

How do I construct this japanese bowl?

How to write papers efficiently when English isn't my first language?

How do scammers retract money, while you can’t?

Is it my responsibility to learn a new technology in my own time my employer wants to implement?

Was a professor correct to chastise me for writing "Prof. X" rather than "Professor X"?

How do I get the green key off the shelf in the Dobby level of Lego Harry Potter 2?

Natural language into sentence logic

Only print output after finding pattern

How to get regions to plot as graphics

Example of a Mathematician/Physicist whose Other Publications during their PhD eclipsed their PhD Thesis

India just shot down a satellite from the ground. At what altitude range is the resulting debris field?

Increase performance creating Mandelbrot set in python

Trouble understanding the speech of overseas colleagues

Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?

Need some help with wall behind rangetop

Which organization defines CJK Unified Ideographs?

Implement the Thanos sorting algorithm

What is the difference between "behavior" and "behaviour"?

How can I get through very long and very dry, but also very useful technical documents when learning a new tool?

How to Reset Passwords on Multiple Websites Easily?

Where to find order of arguments for default functions

Anatomically Correct Mesopelagic Aves

Inappropriate reference requests from Journal reviewers

Term for the "extreme-extension" version of a straw man fallacy?



Magento 2. Retrieve information from env.php in the js files programmatically



The Next CEO of Stack OverflowWhen, in a custom module, you add a subitem to the top menu in the back-end, is it possible to insert in image alongside the title?Magento 2 - Location of Luma theme's Template Files in the Vendor Directorywhat is entity when create an order using REST apiSample files to use Magento 2 API REST and SOAPMagento 2. Create customer account programmatically with no password and confirmation requiredMagento 2 apply tax class programmatically to customerMagento 2 php bin/magento setup:install WITHOUT sample dataMagento 2. Retrieve information from env.php programmaticallyMagento 2.2: moving configs from config.php to env.php after app:config:dumpMagento 2. Use same email templates for emails sent from admin and frontend without duplicating the templates












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?










share|improve this question





























    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?










    share|improve this question



























      0












      0








      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?










      share|improve this question
















      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?







      magento2 configuration






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 19 mins ago









      Teja Bhagavan Kollepara

      3,01241949




      3,01241949










      asked Jan 8 at 6:56









      anilanil

      1069




      1069






















          1 Answer
          1






          active

          oldest

          votes


















          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.






          share|improve this answer
























          • 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 at 8:36














          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "479"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f257068%2fmagento-2-retrieve-information-from-env-php-in-the-js-files-programmatically%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          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.






          share|improve this answer
























          • 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 at 8:36


















          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.






          share|improve this answer
























          • 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 at 8:36
















          1












          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.






          share|improve this 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.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 8 at 7:45









          Amit BeraAmit Bera

          59.5k1676177




          59.5k1676177













          • 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 at 8:36





















          • 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 at 8:36



















          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 at 8:36







          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 at 8:36




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f257068%2fmagento-2-retrieve-information-from-env-php-in-the-js-files-programmatically%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

          How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

          夢乃愛華...