Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ A [bunyan logger](https://github.com/trentm/node-bunyan) instance. Created by de
Sets the timeout (in ms) after that an idle connection is closed by the server
__Default:__ `0`

#### `endOnProcessSignal`
Whether to close ftp server and exit process on SIGTERM/SIGINT/SIGQUIT signals or not
__Default:__ `true`

## CLI

`ftp-srv` also comes with a builtin CLI.
Expand Down
11 changes: 7 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ class FtpServer extends EventEmitter {
whitelist: [],
greeting: null,
tls: false,
timeout: 0
timeout: 0,
endOnProcessSignal: true,
}, options);

this._greeting = this.setupGreeting(this.options.greeting);
Expand Down Expand Up @@ -70,9 +71,11 @@ class FtpServer extends EventEmitter {

const quit = _.debounce(this.quit.bind(this), 100);

process.on('SIGTERM', quit);
process.on('SIGINT', quit);
process.on('SIGQUIT', quit);
if (this.options.endOnProcessSignal) {
process.on('SIGTERM', quit);
process.on('SIGINT', quit);
process.on('SIGQUIT', quit);
}
}

get isTLS() {
Expand Down