Browse Source

cleanup on exit

Signed-off-by: Guillem Bonet <[email protected]>
pull/488/head
Guillem Bonet 3 years ago
parent
commit
5747ae6e49
No known key found for this signature in database GPG Key ID: 48408F6E3AC6F4B4
  1. 10
      src/lib/Server.js

10
src/lib/Server.js

@ -138,6 +138,16 @@ module.exports = class Server {
.listen(PORT, () => { .listen(PORT, () => {
debug(`Listening on http://0.0.0.0:${PORT}`); debug(`Listening on http://0.0.0.0:${PORT}`);
}); });
process.on('SIGTERM', async () => {
debug('SIGTERM signal received: exiting')
Util.exec('wg-quick down wg0').then(() => {
debug('cleaned up wireguard');
});
this.app.close(() => {
debug('HTTP server closed')
})
})
} }
}; };

Loading…
Cancel
Save