Handle multiple Environments
-
Kind of two parts.
What I need is some quasar test command. I think test would be closer to production then to dev.
Something like quasar test would build with a QA url as some variable.
Eventually will need this with cordova. quasar build android --QAReally what is needed is a way to tell the vue code which server to point to.
Local host would be local host (or an ip address)
Dev would point to dev.server.com
Test would point to qa.server.com
prod would point to www.server.comI know webpack can do this, Quasar seems to have its own configuration.
Another question is how to include this in some “services” javascript file. Vue doesn’t have services, sounds like just creating a JS file with some axios commands in. This is where I need to know which server I’m pointing to.
Thanks
-
-
Hi i understood @rstoenescu in http://forum.quasar-framework.org/topic/1827/build-for-environments-other-than-development-and-production/2
With the code
build: { scopeHoisting: true, vueRouterMode: 'history', env: { PROD: process.env.prod === '1' },
Example windows:
set prod =1 && quasar build -> in application will acess process.env.PROD = 1
set prod =0 && quasar build -> in application will acess process.env.PROD = 0Example linux:
export prod =1 && quasar build -> in application will acess process.env.PROD = 1
export prod =0 && quasar build -> in application will acess process.env.PROD = 0 -
If you want, can create N envs
Just change the value of OS envbuild: { scopeHoisting: true, vueRouterMode: 'history', env: { PROD: process.env.prod === '1' STAGE: process.env.prod === '2' TEST: process.env.prod === '3' QA: process.env.prod === '4' },
-
This post is deleted!