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