mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-09-22 09:44:53 +01:00
Merge pull request #5812 from vzagorovskiy/fix/keep-failed-nginx-config-as-err
Keep the failed nginx config as a .conf.err file
This commit is contained in:
@@ -34,7 +34,7 @@ const internalNginx = {
|
||||
// We're deleting this config regardless.
|
||||
// Don't throw errors, as the file may not exist at all
|
||||
// Delete the .err file too
|
||||
return internalNginx.deleteConfig(host_type, host, false, true);
|
||||
return internalNginx.deleteConfig(host_type, host, true);
|
||||
})
|
||||
.then(() => {
|
||||
return internalNginx.generateConfig(host_type, host);
|
||||
@@ -83,10 +83,12 @@ const internalNginx = {
|
||||
meta: combined_meta,
|
||||
})
|
||||
.then(() => {
|
||||
internalNginx.renameConfigAsError(host_type, host);
|
||||
// Keep the failed config as a .err file for inspection
|
||||
return internalNginx.renameConfigAsError(host_type, host);
|
||||
})
|
||||
.then(() => {
|
||||
return internalNginx.deleteConfig(host_type, host, true);
|
||||
// The rename removed the live config already, don't touch the .err file
|
||||
return internalNginx.deleteConfig(host_type, host, false);
|
||||
});
|
||||
});
|
||||
})
|
||||
@@ -378,8 +380,8 @@ const internalNginx = {
|
||||
const config_file_err = `${config_file}.err`;
|
||||
|
||||
return new Promise((resolve /*, reject*/) => {
|
||||
fs.unlink(config_file, () => {
|
||||
// ignore result, continue
|
||||
fs.unlink(config_file_err, () => {
|
||||
// ignore result, a previous .err file may not exist
|
||||
fs.rename(config_file, config_file_err, () => {
|
||||
// also ignore result, as this is a debugging informative file anyway
|
||||
resolve();
|
||||
|
||||
Reference in New Issue
Block a user