[V1] A guide for @quasar/dotenv
-
This post is deleted! -
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 -
@mKomo This is great feedback, thanks!
-
@Hawkeye64 happy to help! If you need a hand with docs / guides feel free to drop message
-
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/dotenvapp: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).
-
@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
-
@s-molinari
Thanks for pointing that out! -
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??
-
@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] } }
-
How do you build a copy based on .env.staging
-
@aeiosapp
quasar.conf.jsonbuild:{ 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" }
-
@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': '' } },