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 more