fix: ensure correct env is shown if it's changed within app

This commit is contained in:
Alexis Tyler
2021-05-28 08:34:26 +09:30
parent b1a58f9511
commit e9bebbbaa7

View File

@@ -90,7 +90,7 @@ const commands = {
setEnv('LOG_TRANSPORT', mainOptions['log-transport']);
setEnv('PORT', mainOptions.port);
console.log(`Starting unraid-api in "${environment}" mode.`);
console.log(`Starting unraid-api in "${process.env.ENVIRONMENT!}" mode.`);
// Load bundled index file
const indexPath = './index.js';
@@ -207,7 +207,7 @@ const commands = {
}
// Copy the new env over before restarting
await fs.promises.copyFile(path.join(basePath, `.env.${currentEnv ?? 'production'}`), path.join(basePath, '.env'))
await fs.promises.copyFile(path.join(basePath, `.env.${currentEnv ?? 'production'}`), path.join(basePath, '.env'));
// Restart the process
return this.restart();