Skip to content

Commit

Permalink
simplify server kind configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarinPostma committed Feb 27, 2024
1 parent d1941cc commit 7779f05
Show file tree
Hide file tree
Showing 2 changed files with 161 additions and 255 deletions.
7 changes: 4 additions & 3 deletions libsql-server/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ pub struct RpcClientConfig<C = HttpConnector> {
}

impl<C: Connector> RpcClientConfig<C> {
pub(crate) async fn configure(self) -> anyhow::Result<(Channel, tonic::transport::Uri)> {
let uri = tonic::transport::Uri::from_maybe_shared(self.remote_url)?;
pub(crate) async fn configure(&self) -> anyhow::Result<(Channel, tonic::transport::Uri)> {
let uri = tonic::transport::Uri::from_maybe_shared(self.remote_url.clone())?;
let mut builder = Channel::builder(uri.clone());
if let Some(ref tls_config) = self.tls_config {
let cert_pem = std::fs::read_to_string(&tls_config.cert)?;
Expand All @@ -38,7 +38,8 @@ impl<C: Connector> RpcClientConfig<C> {
builder = builder.tls_config(tls_config)?;
}

let channel = builder.connect_with_connector_lazy(self.connector.map_err(Into::into));
let channel =
builder.connect_with_connector_lazy(self.connector.clone().map_err(Into::into));

Ok((channel, uri))
}
Expand Down
Loading

0 comments on commit 7779f05

Please sign in to comment.