pub async fn run_server(config: Arc<ConfigHandle>) -> Result<ServerHandle>Expand description
Start the proxy server.
Binds to config.server.listen_addr(), builds the pipeline from
config.stages / config.policy, and serves requests until
ServerHandle::shutdown is called.
§Errors
Returns an error if the listen address cannot be bound.
§Examples
use guardrail_config::ConfigHandle;
use guardrail_proxy::run_server;
use std::sync::Arc;
let config = Arc::new(ConfigHandle::load("guardrail.toml").unwrap());
let handle = run_server(config).await.unwrap();
println!("listening on {}", handle.local_addr());
handle.shutdown();