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

    [V1] A guide for @quasar/dotenv

    Useful Tips (NEW)
    cli dotenv extension v1.0
    9
    14
    3036
    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.
    • nothingismagick
      nothingismagick last edited by

      This post is deleted!
      1 Reply Last reply Reply Quote 0
      • nothingismagick
        nothingismagick last edited by

        I just created two issues that should hopefully resolve your concerns.

        https://github.com/quasarframework/app-extension-dotenv/issues/3
        https://github.com/quasarframework/app-extension-dotenv/issues/4

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

          @mKomo This is great feedback, thanks!

          M 1 Reply Last reply Reply Quote 0
          • M
            mKomo @Hawkeye64 last edited by

            @Hawkeye64 happy to help! If you need a hand with docs / guides feel free to drop message šŸ™‚

            1 Reply Last reply Reply Quote 0
            • A
              AndrewE last edited by AndrewE

              How do you get the prompts?
              I’ve installed and unistalled and re-installed @quasar/dotenv, but I do not get the prompts to set the env files. I’ve added dev.env and prod.env files manually and put my firebase config in them. However, I get a build error that App Extension ā€œ@quasar/dotenvā€ has missing index script…
              Is this script created via the prompts? Where would this script be found?
              When I run ā€œaddā€ it just lists the extension and shows an empty prompts object:
              $quasar ext add @quasar/dotenv

              app:extension-manager Listing installed App Extensions +0ms
              
              Extension name: @quasar/dotenv
              Extension prompts: {}
              

              update: I got no prompts when trying to run dotenv in a clone of https://github.com/kpapro/quasar-firebase-firestore

              I did get prompts in my project folder which was init’ed with the recent quasar build (v1.0.0-beta.19).

              1 Reply Last reply Reply Quote 0
              • s.molinari
                s.molinari last edited by

                @AndrewE - The way it looks in that firebase scaffold, the dotenv app extension is already installed. Theoretically, the author of that repo should be making an app extension themselves to install that scaffold. 😁

                Scott

                A 1 Reply Last reply Reply Quote 0
                • A
                  AndrewE @s.molinari last edited by

                  @s-molinari
                  Thanks for pointing that out!

                  1 Reply Last reply Reply Quote 0
                  • A
                    aeiosapp last edited by

                    Nice solution, by the way it works fine when I call process.env.MYVAR jn the <script> section of my *.vue file, but it doesn’t work when I call it in my src/app/local.js file where I’d like to put some functions that I’ll call in a <script> of *.vue file. Any ideas how to handle it??

                    A 1 Reply Last reply Reply Quote 0
                    • A
                      aeiosapp @aeiosapp last edited by

                      @aeiosapp said in [V1] A guide for @quasar/dotenv:

                      Nice solution, by the way it works fine when I call process.env.MYVAR jn the <script> section of my *.vue file, but it doesn’t work when I call it in my src/app/local.js file where I’d like to put some functions that I’ll call in a <script> of *.vue file. Any ideas how to handle it??

                      Found solution for my question. Just had to add this code in my src/app/local.js file:

                      const DotEnv = require('dotenv')
                      
                      if(parsedEnv = DotEnv.config().parsed) {
                        for (let key in parsedEnv) {
                          process.env[key] = parsedEnv[key]
                        }
                      }
                      
                      
                      A 1 Reply Last reply Reply Quote 0
                      • C
                        Christal last edited by

                        How do you build a copy based on .env.staging

                        1 Reply Last reply Reply Quote 0
                        • A
                          ArkIv @aeiosapp last edited by

                          @aeiosapp
                          quasar.conf.json

                          build:{
                             env: {...require("./config_env")}
                            ... or
                             env: {
                                  version: require("./package.json").version,
                                  ...require("./config_env")
                                },
                           ... or
                            env: {...require("./config_env"), 
                                  ...require("./config_env-2"}
                          

                          ./config_env.js

                          module.exports={
                           title: "no dotenv"
                          }
                          
                          B 1 Reply Last reply Reply Quote 0
                          • B
                            baramofme @ArkIv last edited by

                            @ArkIv That’s good.

                            dotenv not working my quasar. so I mixed your method + qenv.

                            .quasar.env.json

                            {
                              "development": {
                                "ENV_TYPE": "Running Development",
                                "ENV_DEV": "Development",
                                "API_URL": "https://dev.some.com"
                              },
                              "production": {
                                "ENV_TYPE": "Running Production",
                                "ENV_PROD": "Production",
                                "API_URL": "https://some.com"
                              },
                              "test": {
                                "ENV_TYPE": "Running Test",
                                "ENV_Test": "Test"
                              },
                              "stage": {
                                "ENV_TYPE": "Running Stage",
                                "ENV_STAGE": "Stage",
                                "API_URL": "https://stg.some.com"
                              }
                            }
                            
                            

                            quasar.conf.json

                            const configEnv = require('./.quasar.env.json')
                            
                            module.exports = configure(function (ctx) {
                              return {
                                ......
                                      env: {
                                         // for settting proxy address with ctx.dev, ctx.prod
                                         IS_STAGE: false,
                                      },
                                },
                            
                                devServer: {
                                  proxy: {
                                    // proxy all requests starting with /api to specific url
                                    '/api': {
                                      target: ctx.prod ? configEnv["production"].API_URL
                                      : process.env.IS_STAGE ? configEnv["stage"].API_URL
                                          : configEnv["development"].API_URL,
                                      changeOrigin: true,
                                      pathRewrite: {
                                        '^/api': ''
                                      }
                                    },
                             
                            
                            1 Reply Last reply Reply Quote 1
                            • First post
                              Last post