mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-18 19:32:21 -06:00
Improve database scripts to retrieve the provider from env file
This commit is contained in:
22
runWithProvider.js
Normal file
22
runWithProvider.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const dotenv = require('dotenv');
|
||||
const { execSync } = require('child_process');
|
||||
dotenv.config();
|
||||
|
||||
const { DATABASE_PROVIDER } = process.env;
|
||||
|
||||
if (!DATABASE_PROVIDER) {
|
||||
console.error('DATABASE_PROVIDER is not set in the .env file');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const command = process.argv
|
||||
.slice(2)
|
||||
.join(' ')
|
||||
.replace(/\DATABASE_PROVIDER/g, DATABASE_PROVIDER);
|
||||
|
||||
try {
|
||||
execSync(command, { stdio: 'inherit' });
|
||||
} catch (error) {
|
||||
console.error(`Error executing command: ${command}`);
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user