chore: better cli logging

This commit is contained in:
Alexis Tyler
2021-08-25 08:23:15 +09:30
parent d57bd19947
commit 7e1194ef46

View File

@@ -219,10 +219,15 @@ const commands = {
}
// Write new env to flash
await fs.promises.writeFile(envFlashFilePath, `env="${newEnv}"`);
const newEnvLine = `env="${newEnv}"`;
await fs.promises.writeFile(envFlashFilePath, newEnvLine);
logger.debug('Writing %s to %s', newEnvLine, envFlashFilePath);
// Copy the new env over to live location before restarting
await fs.promises.copyFile(path.join(basePath, `.env.${newEnv}`), path.join(basePath, '.env'));
const newDotEnvFilePath = path.join(basePath, `.env.${newEnv}`);
const dotEnvFilePath = path.join(basePath, '.env');
await fs.promises.copyFile(newDotEnvFilePath, dotEnvFilePath);
logger.debug('Copying %s to %s', newDotEnvFilePath, dotEnvFilePath);
// If there's a process running restart it
const unraidApiPid = await getUnraidApiPid();