You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Using the npx vendure migrate command ignores configuration for the database. For simple projects this might not be a problem, but for production ready code that is usually configured by environment variables this becomes a problem.
Describe the solution you'd like
A env file parameter. Even better might be an option to configure the CLI once like: vendure env .env.
I image if the vendure cli might support triggering e2e test at one point it might be cool to even configure a test environment like this as well.
Describe alternatives you've considered
I added a JS script to handle that:
constfs=require('fs');const{ spawn }=require('child_process');constdotenv=require('dotenv');letargs=process.argv.slice(2);letenvFile;// Add default environment fileif(args.length>=1){if(fs.existsSync(args[0])){envFile=args[0];}elseif(fs.existsSync(`.env.${args[0]}`)){envFile=`.env.${args[0]}`;}}if(!envFile){envFile='.env';args=[envFile, ...args];}if(fs.existsSync(envFile)){console.log(`[withEnv]`,`Loading environment from: ${envFile}`);dotenv.config({path: envFile,});if(args.length>=2){constcommand=args[1];constcommandArgs=args.slice(2);constoptions={stdio: 'inherit',shell: true};// This will allow the child process to use the parent's stdin, stdout, and stderr.console.log(`[withEnv]`,`Execute shell command: ${command}${commandArgs.join(' ')}`);constchild=spawn(command,commandArgs,options);child.on('error',error=>{console.error(`[withEnv]`,`Failed to start subprocess.`,error);});child.on('exit',function(code,signal){console.log(`child process exited with code ${code} and signal ${signal}`);});}}else{console.error(`[withEnv]`,`Environment file: ${envFile} not found!`);process.exit(1);}
Using it like: node dev/spawnWithEnv.js npx vendure migrate
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Using the
npx vendure migrate
command ignores configuration for the database. For simple projects this might not be a problem, but for production ready code that is usually configured by environment variables this becomes a problem.Describe the solution you'd like
A env file parameter. Even better might be an option to configure the CLI once like:
vendure env .env
.I image if the vendure cli might support triggering e2e test at one point it might be cool to even configure a test environment like this as well.
Describe alternatives you've considered
I added a JS script to handle that:
Using it like:
node dev/spawnWithEnv.js npx vendure migrate
The text was updated successfully, but these errors were encountered: