No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Reading environment variables from server (not .env file) when using @quasar/quasar-app-extension-dotenv

    Help
    3
    3
    606
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      JiProchzaka last edited by

      Hi,

      I’m using @quasar/quasar-app-extension-dotenv for loading environment variables during the development from .env file on my localhost.

      In the production I’m hosting the project on Netlify and when I set the environment variables in the Netlify dashboard it is undefined during the program run.

      My quasar.extensions.json looks like this:

      {
        "@quasar/dotenv": {
          "env_development": ".env",
          "env_production": ".env",
          "common_root_object": "none",
          "create_env_files": false,
          "add_env_to_gitignore": false       
        }
      }
      

      Any ideas how to load variables from server variables?

      Thanks

      1 Reply Last reply Reply Quote 0
      • B
        bkirvin last edited by

        I did this on Azure by serving the Vue app as a Node/Express public folder, then create an endpoint on Express that returns the process.env object to the Vue application’s GET request. Worked like a charm.

        Create an express project. Add interface/ to the root and then build your Vue app there. Set Express to serve interface/dist and your builds will be served by Express.

        Deploy the express app to your web application.

        1 Reply Last reply Reply Quote 0
        • Hawkeye64
          Hawkeye64 last edited by

          @JiProchzaka The way I use Netlify, is that it pulls my Github repo over and builds it. You shouldn’t be keeping your .env in a repo because they usually contain sensistive data. But, that means Netlify will build your project without a .env, meaning no variables. 😞

          At least, this is my hypothesis for you.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post