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

    proxy target does not resolve process.env.ROOT_API

    Framework
    3
    4
    274
    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.
    • sandroden
      sandroden last edited by

      Hi,

      I just realized that I cannot use process.env in quasar.conf.js. I was trying to set the proxy via an env variable set via @quasar/qenv.

      My conf was:

      devServer: {
        proxy: {
          '/media': {
            // target: process.env.ROOT_API,  // this doesn not work
            target: 'http://127.0.0.1:8000',
            changeOrigin: true,
            logLevel: 'debug'
          }
        },
      

      Is there some more steps I should do to use process.env in quasar.conf.js (it’s working correctly in boot file in axios)?

      thanks in advance
      sandro

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

        @sandroden did you check this out yet? https://quasar.dev/quasar-cli/cli-documentation/handling-process-env#Adding-to-process.env

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

          Thanks, I read it when but clearly w/o enough attention… I tested it now and in fact within quasar.conf.js process.env sees already the variables. So the problem seems related to qenv that doesn’t propagate the env variable early enough. Do I interpret it correctly?

          1 Reply Last reply Reply Quote 0
          • M
            mitchellmonaghan last edited by

            I ran into this issue as well. I did this at the top of quasar.conf.js. You then can access your env on the new variable. Sorry for necro just thought it might help someone.

            const envFile = require('./.quasar.env.json')
            const env = envFile[process.env.QENV]
            
            1 Reply Last reply Reply Quote 2
            • First post
              Last post