Skip to content

Commit c27c429

Browse files
committed
cargo fmt
1 parent 09deeb4 commit c27c429

1 file changed

Lines changed: 20 additions & 12 deletions

File tree

  • aggregation_mode/gateway/src

aggregation_mode/gateway/src/http.rs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,16 @@ impl GatewayServer {
6363
}
6464

6565
#[cfg(feature = "tls")]
66-
fn load_tls_config(cert_path: &str, key_path: &str) -> Result<ServerConfig, Box<dyn std::error::Error>> {
66+
fn load_tls_config(
67+
cert_path: &str,
68+
key_path: &str,
69+
) -> Result<ServerConfig, Box<dyn std::error::Error>> {
6770
// Install the default crypto provider
6871
let _ = rustls::crypto::aws_lc_rs::default_provider().install_default();
6972

7073
// Load certificate chain
71-
let certs: Vec<CertificateDer> = CertificateDer::pem_file_iter(cert_path)?
72-
.collect::<Result<Vec<_>, _>>()?;
74+
let certs: Vec<CertificateDer> =
75+
CertificateDer::pem_file_iter(cert_path)?.collect::<Result<Vec<_>, _>>()?;
7376

7477
// Load private key
7578
let private_key = PrivateKeyDer::from_pem_file(key_path)?;
@@ -98,7 +101,12 @@ impl GatewayServer {
98101
#[cfg(not(feature = "tls"))]
99102
let protocol = "http";
100103

101-
tracing::info!("Starting server at {}://{}:{}", protocol, self.config.ip, self.config.port);
104+
tracing::info!(
105+
"Starting server at {}://{}:{}",
106+
protocol,
107+
self.config.ip,
108+
self.config.port
109+
);
102110

103111
let server = HttpServer::new(move || {
104112
App::new()
@@ -114,20 +122,20 @@ impl GatewayServer {
114122

115123
#[cfg(feature = "tls")]
116124
let server = {
117-
let tls_config = Self::load_tls_config(&self.config.tls_cert_path, &self.config.tls_key_path)
118-
.expect("Failed to load TLS configuration");
119-
server.bind_rustls_0_23((self.config.ip.as_str(), port), tls_config)
125+
let tls_config =
126+
Self::load_tls_config(&self.config.tls_cert_path, &self.config.tls_key_path)
127+
.expect("Failed to load TLS configuration");
128+
server
129+
.bind_rustls_0_23((self.config.ip.as_str(), port), tls_config)
120130
.expect("To bind socket correctly with TLS")
121131
};
122132

123133
#[cfg(not(feature = "tls"))]
124-
let server = server.bind((self.config.ip.as_str(), port))
134+
let server = server
135+
.bind((self.config.ip.as_str(), port))
125136
.expect("To bind socket correctly");
126137

127-
server
128-
.run()
129-
.await
130-
.expect("Server to never end");
138+
server.run().await.expect("Server to never end");
131139
}
132140

133141
// Returns an OK response (code 200), no matters what receives in the request

0 commit comments

Comments
 (0)