feat: support graceful shutdown
This commit is contained in:
@@ -12,3 +12,15 @@ WireGuard.getConfig()
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
// Handle terminate signal
|
||||
process.on('SIGTERM', async() => {
|
||||
console.log('SIGTERM signal received.');
|
||||
await WireGuard.Shutdown();
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
// Handle interupt signal
|
||||
process.on('SIGINT', () => {
|
||||
console.log('SIGINT signal received.');
|
||||
});
|
||||
Reference in New Issue
Block a user