Skip to content

Commit e4b8487

Browse files
Fixed the handling of the signals field of the runtime API server (#104)
1 parent fc64c0b commit e4b8487

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

runtime/src/main.rs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,22 @@ async fn main() {
186186
let api_port = *API_SERVER_PORT;
187187
info!("Try to start the API server on 'http://localhost:{api_port}'...");
188188

189+
// The shutdown configuration for the runtime API server:
190+
let mut shutdown = Shutdown {
191+
// We do not want to use the Ctrl+C signal to stop the server:
192+
ctrlc: false,
193+
194+
// Everything else is set to default for now:
195+
..Shutdown::default()
196+
};
197+
198+
#[cfg(unix)]
199+
{
200+
// We do not want to use the termination signal to stop the server.
201+
// This option, however, is only available on Unix systems:
202+
shutdown.signals = HashSet::new();
203+
}
204+
189205
// Configure the runtime API server:
190206
let figment = Figment::from(rocket::Config::release_default())
191207

@@ -213,17 +229,7 @@ async fn main() {
213229
.merge(("tls.key", certificate_data.key_pair.serialize_pem().as_bytes()))
214230

215231
// Set the shutdown configuration:
216-
.merge(("shutdown", Shutdown {
217-
218-
// Again, we do not want to use the Ctrl+C signal to stop the server:
219-
ctrlc: false,
220-
221-
// We do not want to use the termination signal to stop the server:
222-
signals: HashSet::new(),
223-
224-
// Everything else is set to default:
225-
..Shutdown::default()
226-
}));
232+
.merge(("shutdown", shutdown));
227233

228234
//
229235
// Start the runtime API server in a separate thread. This is necessary

0 commit comments

Comments
 (0)