holger-server-lib 0.6.9

Holger server library: config, wiring, gRPC service, Rust API
//! Exposed endpoints: the listener side of the wiring graph.
//!
//! An [`ExposedEndpoint`] is a RON-configured serving surface — a gRPC address,
//! optionally a twin HTTP/OCI address (`ron_http_url`) fronting the same repos
//! for ecosystem clients (helm/pip/cargo, OCI registry) plus `/healthz`+`/readyz`.
//! One `ron_tls` covers BOTH ports; absent = cleartext, dev/loopback only.
//! Submodules: `http` (the gateway), `tls` (settings/loading), `fast_routes`
//! (per-endpoint aggregated repo lookup, attached last in the wiring pass).
//!
//! Gotcha: `wired_{in,out}_repositories` hold raw `*const Repository` back-refs
//! and are `#[serde(skip)]` — they are populated by the wiring engine after the
//! graph is indexed, so they are dangling/empty on a freshly deserialized config
//! and must never outlive the `Repository` arena that backs them.

use serde::{Deserialize, Serialize};
use fast_routes::FastRoutes;
use crate::repository::Repository;

pub mod fast_routes;
pub mod http;
pub mod tls;

/// An exposed gRPC endpoint configured in RON
#[derive(Serialize, Deserialize)]
pub struct ExposedEndpoint {
    pub ron_name: String,
    pub ron_url: String, // e.g. "0.0.0.0:50051"

    /// Optional HTTP/OCI listener (e.g. "0.0.0.0:8443") serving the same
    /// repositories to ecosystem clients (helm/pip/cargo, OCI registry) plus
    /// /healthz and /readyz for Kubernetes probes.
    #[serde(default)]
    pub ron_http_url: Option<String>,

    /// Optional TLS for this endpoint. Applies to BOTH the gRPC port and the
    /// HTTP/OCI port. Absent = cleartext (loopback/dev only; logged loudly).
    #[serde(default)]
    pub ron_tls: Option<crate::exposed::tls::TlsSettings>,

    /// Max accepted request-body size for the HTTP/OCI gateway, in bytes.
    /// Guards against memory-exhaustion uploads. Default 1 GiB.
    #[serde(default)]
    pub ron_max_body_bytes: Option<usize>,

    #[serde(skip_serializing, skip_deserializing, default)]
    pub aggregated_routes: Option<FastRoutes>,

    #[serde(skip_serializing, skip_deserializing, default)]
    pub wired_in_repositories: Vec<*const Repository>,
    #[serde(skip_serializing, skip_deserializing, default)]
    pub wired_out_repositories: Vec<*const Repository>,
}