spin_factor_outbound_http/runtime_config/
spin.rs1use serde::Deserialize;
2use spin_factors::runtime_config::toml::GetTomlValue;
3
4pub fn config_from_table(
13 table: &impl GetTomlValue,
14) -> anyhow::Result<Option<super::RuntimeConfig>> {
15 if let Some(outbound_http) = table.get("outbound_http") {
16 let outbound_http_toml = outbound_http.clone().try_into::<OutboundHttpToml>()?;
17 Ok(Some(super::RuntimeConfig {
18 connection_pooling_enabled: outbound_http_toml.connection_pooling,
19 max_concurrent_connections: outbound_http_toml.max_concurrent_requests,
20 }))
21 } else {
22 Ok(None)
23 }
24}
25
26#[derive(Debug, Default, Deserialize)]
27#[serde(deny_unknown_fields)]
28struct OutboundHttpToml {
29 #[serde(default)]
30 connection_pooling: bool,
31 #[serde(default)]
32 max_concurrent_requests: Option<usize>,
33}