add option to disable listeners
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
e56d3c6cb3
commit
5167e1f06d
3 changed files with 20 additions and 4 deletions
|
@ -6,7 +6,7 @@ mod unix;
|
|||
use std::sync::Arc;
|
||||
|
||||
use axum_server::Handle as ServerHandle;
|
||||
use conduwuit::Result;
|
||||
use conduwuit::{err, Result};
|
||||
use conduwuit_service::Services;
|
||||
use tokio::sync::broadcast;
|
||||
|
||||
|
@ -16,13 +16,19 @@ use super::layers;
|
|||
pub(super) async fn serve(
|
||||
services: Arc<Services>,
|
||||
handle: ServerHandle,
|
||||
shutdown: broadcast::Receiver<()>,
|
||||
) -> Result<()> {
|
||||
mut shutdown: broadcast::Receiver<()>,
|
||||
) -> Result {
|
||||
let server = &services.server;
|
||||
let config = &server.config;
|
||||
if !config.listening {
|
||||
return shutdown
|
||||
.recv()
|
||||
.await
|
||||
.map_err(|e| err!(error!("channel error: {e}")));
|
||||
}
|
||||
|
||||
let addrs = config.get_bind_addrs();
|
||||
let (app, _guard) = layers::build(&services)?;
|
||||
|
||||
if cfg!(unix) && config.unix_socket_path.is_some() {
|
||||
unix::serve(server, app, shutdown).await
|
||||
} else if config.tls.certs.is_some() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue