pub struct ProxyConfig {
pub bind: String,
pub upstream_anthropic: String,
pub upstream_openai: String,
pub db_path: String,
pub tenant_id: String,
pub prompt_salt: String,
pub mode: Mode,
pub routing: Option<Config>,
pub prices: PriceTable,
pub max_concurrency: usize,
}Expand description
Runtime configuration for the proxy.
Fields§
§bind: StringAddress to bind the HTTP server to, e.g. 127.0.0.1:8080.
upstream_anthropic: StringBase URL of the upstream Anthropic-compatible API.
upstream_openai: StringBase URL of the upstream OpenAI-compatible API.
db_path: StringPath to the SQLite trace database.
tenant_id: StringTenant identifier stamped on every trace.
prompt_salt: StringSalt mixed into the prompt hash so raw prompt text never touches storage.
mode: ModeDefault mode when no routing config matches (observe unless overridden).
routing: Option<Config>Optional declarative routing config (§8.4). When present, its routes decide the mode, ladder, and gates per request; enforce routes activate the escalation engine.
prices: PriceTableModel pricing table used to cost each attempt.
max_concurrency: usizeMax in-flight requests before new ones queue behind the concurrency limiter
(FIRSTPASS_MAX_CONCURRENCY, default 512). A load-shed valve, not a timeout — it never
severs an in-flight SSE stream.
Implementations§
Source§impl ProxyConfig
impl ProxyConfig
Sourcepub fn from_env() -> Result<Self, ConfigError>
pub fn from_env() -> Result<Self, ConfigError>
Load configuration from environment variables, falling back to local defaults.
§Errors
ConfigError::UnsupportedMode for an unknown FIRSTPASS_MODE; ConfigError::Config
if the FIRSTPASS_CONFIG routing file cannot be read or parsed.
Sourcepub fn from_lookup(
lookup: impl Fn(&str) -> Option<String>,
) -> Result<Self, ConfigError>
pub fn from_lookup( lookup: impl Fn(&str) -> Option<String>, ) -> Result<Self, ConfigError>
Load configuration from an arbitrary key lookup — the seam from_env uses, exposed
so tests can exercise defaulting/validation without touching real process env vars.
The routing config is supplied inline via the FIRSTPASS_CONFIG_TOML key.
§Errors
ConfigError::UnsupportedMode for an unknown FIRSTPASS_MODE; ConfigError::Config
if the inline routing TOML fails to parse.
Trait Implementations§
Source§impl Clone for ProxyConfig
impl Clone for ProxyConfig
Source§fn clone(&self) -> ProxyConfig
fn clone(&self) -> ProxyConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ProxyConfig
impl RefUnwindSafe for ProxyConfig
impl Send for ProxyConfig
impl Sync for ProxyConfig
impl Unpin for ProxyConfig
impl UnsafeUnpin for ProxyConfig
impl UnwindSafe for ProxyConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more