Skip to content

Build using environment variables in staging #17191

Discussion options

You must be logged in to vote

I finally managed to find a workaround to get it working

I created this file: \variables\parser.js

`const dotenv = require('dotenv');

const files = {
...dotenv.config({ path: 'variables/.env' }).parsed,
...dotenv.config({ path: variables/.env.${process.env.ENVIRONMENT} }).parsed,
...dotenv.config({ path: variables/.env.${process.env.ENVIRONMENT}.local }).parsed,
};

module.exports = () =>
{
Object.keys(files, (key) =>
{
if (typeof files[key] !== 'string')
{
files[key] = JSON.stringify(files[key]);
}
});
return files;
};
`

In the same folder I created different .env files (e.g. .env.staging) where I added the variables they needed

Inside quasar.config.js I added this line to the top:
const …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@rstoenescu
Comment options

Answer selected by AdagioB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants