potree-auth 0.1.0

Authentication and project management for `potree` point clouds.
Documentation
/// Provides a future that completes when `Ctrl+C` or `sigterm` is recieved.
///
/// Enables an axum server to shutdown gracefully. I.e. it will stop accepting
/// new connections and finish handling the connections that are actively
/// in-flight.
pub async fn shutdown_signal() {
    let ctrl_c = async {
        tokio::signal::ctrl_c()
            .await
            .expect("Failed to install Ctrl+C handler");
    };

    #[cfg(unix)]
    let terminate = async {
        tokio::signal::unix::signal(tokio::signal::unix::SignalKind::terminate())
            .expect("Failed to install SIGTERM handler")
            .recv()
            .await;
    };

    #[cfg(not(unix))]
    let terminate = std::future::pending::<()>(); // No SIGTERM on non-Unix systems

    tokio::select! {
        _ = ctrl_c => {},
        _ = terminate => {},
    }

    tracing::info!("Shutdown signal received");
}