pub struct GatewayConfig {
pub host: String,
pub port: u16,
pub expose_api_docs: bool,
}Expand description
Gateway configuration.
Fields§
§host: StringHost to bind the gateway to.
port: u16Port for the gateway server.
expose_api_docs: boolExpose /api-docs (Swagger UI) and /openapi.json.
For safety this is gated to localhost-only binds (127.0.0.0/8, ::1,
“localhost”). Setting this to true while binding to a public address
is a no-op. Default: false.
Why: Swagger UI + the full OpenAPI schema expand the attack surface (route discovery, parameter names, security scheme details). Local dev typically wants them; production typically does not.
Implementations§
Source§impl GatewayConfig
impl GatewayConfig
Sourcepub fn should_expose_api_docs(&self) -> bool
pub fn should_expose_api_docs(&self) -> bool
Whether the gateway may expose /api-docs and /openapi.json.
Returns true only when both:
expose_api_docsis explicitly enabled, AND- the bind address is a loopback address.
Trait Implementations§
Source§impl Clone for GatewayConfig
impl Clone for GatewayConfig
Source§fn clone(&self) -> GatewayConfig
fn clone(&self) -> GatewayConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GatewayConfig
impl Debug for GatewayConfig
Source§impl Default for GatewayConfig
impl Default for GatewayConfig
Source§impl<'de> Deserialize<'de> for GatewayConfig
impl<'de> Deserialize<'de> for GatewayConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for GatewayConfig
impl RefUnwindSafe for GatewayConfig
impl Send for GatewayConfig
impl Sync for GatewayConfig
impl Unpin for GatewayConfig
impl UnsafeUnpin for GatewayConfig
impl UnwindSafe for GatewayConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more