Skip to main content

Config

Struct Config 

Source
pub struct Config {
Show 16 fields pub bind: SocketAddr, pub grpc_bind: Option<SocketAddr>, pub upstream: String, pub index: String, pub tokens: Vec<(String, String)>, pub require_tls_for_mutation: bool, pub tls: Option<TlsConfig>, pub observability: ObservabilityConfig, pub admin_passthrough: Option<AdminPassthroughConfig>, pub cursor_affinity_key: Option<String>, pub passthrough: Option<PassthroughConfig>, pub header_forwarding: HeaderForwardingConfig, pub capture: Option<CaptureConfig>, pub capture_default: bool, pub fanout: Option<FanoutConfig>, pub etcd: Option<EtcdConfig>,
}
Expand description

The fully validated configuration the binary serves from. Every field is a ready-to-use value object; no further parsing or fallbacks happen downstream.

Fields§

§bind: SocketAddr

The HTTP ingress bind address.

§grpc_bind: Option<SocketAddr>

The optional gRPC ingress bind address (off when None).

§upstream: String

The upstream OpenSearch base URL for the single configured cluster.

§index: String

The shared physical index the reference tenancy writes into.

§tokens: Vec<(String, String)>

The token -> principal auth map; empty means permissive dev mode.

§require_tls_for_mutation: bool

Whether a body-mutating request is refused over cleartext (NFR-S1). True (enforce) unless allow_cleartext_mutation opts out.

§tls: Option<TlsConfig>

TLS termination settings, or None for cleartext ingress.

§observability: ObservabilityConfig

Observability + control-plane settings.

§admin_passthrough: Option<AdminPassthroughConfig>

Admin (_cat/_cluster/_nodes) pass-through policy, or None to reject.

§cursor_affinity_key: Option<String>

The shared HMAC key enabling scroll/PIT cursor affinity, or None (off).

§passthrough: Option<PassthroughConfig>

Tenant-agnostic passthrough policy, or None = pure tenancy mode (the default). Used for a transparent proxy or to pass selected (e.g. not-yet- onboarded) indices through verbatim while tenant-isolating the rest.

§header_forwarding: HeaderForwardingConfig

Which client headers the proxy relays to the upstream when it forwards a request (the verbatim passthrough/admin/cursor paths). Pass-all by default (sidecar trust), minus the mandatory hop-by-hop/framing set.

§capture: Option<CaptureConfig>

Full-fidelity traffic capture to a Kafka topic, or None (off). Requires the binary be built with the capture feature; a configured capture on a binary without it is a loud startup error rather than a silent no-op.

§capture_default: bool

Whether capture is on for every request before any directive (default false). false = capture on demand: nothing is teed until a published capture directive selects requests. true = always-capture (a dedicated capture/migration proxy). Independent of the sink: it only decides when to capture; the sink still needs the capture feature + config.

§fanout: Option<FanoutConfig>

Async fan-out write queue (docs/04 §9), or None (off). Requires the fanout feature; a configured fan-out on a binary without it is a loud startup error rather than a silent no-op.

§etcd: Option<EtcdConfig>

etcd-backed distributed directive store (docs/05 §3), or None to use the in-memory store + admin publish endpoint. Requires the etcd feature; a configured etcd on a binary without it is a loud startup error.

Implementations§

Source§

impl Config

Source

pub fn load<I: IntoIterator<Item = String>>( args: I, ) -> Result<Self, ConfigError>

Loads and validates configuration from the process environment plus args (CLI flags without the program name). A --config <path> flag, or the OSPROXY_CONFIG env var, names a config file read as the lowest layer.

§Errors

Returns a ConfigError if a file/flag is malformed, a key is unknown, or any value fails validation, before any socket is opened.

Source

pub fn resolve_for_test(pairs: &[(&str, &str)]) -> Result<Self, ConfigError>

Test-only: resolve a Config directly from an in-memory (key, value) list (canonical keys), skipping the file/env/flag layering. Lets tests and doc examples exercise validation without touching the process environment.

§Errors

Returns a ConfigError if any value fails validation.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Config

Source§

impl PartialEq for Config

Source§

fn eq(&self, other: &Config) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Config

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.