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

    How to support multiple environments

    Help
    4
    8
    1407
    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.
    • G
      Gsaada last edited by

      I’m trying to create project with multiple environments: staging, prod, test + development obviously.
      With Vuejs that’s pretty straightforward

      vue-cli-service build --mode staging
      

      And create .env.staging file.

      Important note that process.env should be accessed from quasar.conf file in order to set different publicPath for each env.

      How can I achieve this behavior at Quasar?

      Thanks

      dobbel 1 Reply Last reply Reply Quote 0
      • dobbel
        dobbel @Gsaada last edited by

        @Gsaada

        https://quasar.dev/quasar-cli/quasar-conf-js#Example-setting-env-for-dev%2Fbuild

        1 Reply Last reply Reply Quote 0
        • G
          Gsaada last edited by

          Thanks @dobbel but I already read this.
          This solution help me only for build process. How should I create .env.staging file and use it in the code?

          dobbel 1 Reply Last reply Reply Quote 0
          • dobbel
            dobbel @Gsaada last edited by

            @Gsaada

            https://github.com/quasarframework/app-extension-dotenv/tree/dev/app-extension

            https://github.com/quasarframework/app-extension-qenv/tree/dev/app-extension

            tlloyduk 1 Reply Last reply Reply Quote 0
            • tlloyduk
              tlloyduk @dobbel last edited by

              Did anyone get a solution for dev, staging and production environments ?

              I had the idea of using quasar build -d (debug mode) as staging and quasar build as production, each with its own dist folder, and I set a DEPLOY_MODE env variable accordingly:

              build: {
                    distDir: ctx.debug ? `dist/${ctx.modeName}-dev` : `dist/${ctx.modeName}`,
                    env: {
                      DEPLOY_MODE: ctx.prod && !ctx.debug ? 'PRODUCTION' : (ctx.prod && ctx.debug ? 'STAGING' : 'DEV')
                    },
              

              Then in my boot file, I use process.env.DEPLOY_MODE to determine which keys to use in my production env file, since quasar/dotenv extension only seems to support two environments (side note: I saw someone committed some changes on github to support staging but it was then reverted)

              This works, but I wondered if anyone else had a more elegant solution ?

              metalsadman 1 Reply Last reply Reply Quote 1
              • metalsadman
                metalsadman @tlloyduk last edited by

                @tlloyduk take a look on qenv app extension.

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

                  ok will do

                  tlloyduk 1 Reply Last reply Reply Quote 0
                  • tlloyduk
                    tlloyduk @tlloyduk last edited by

                    @tlloyduk replying to myself here, but I am not sure qenv is vastly different to what I proposed so will stick to my original plan!

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