Skip to content

Commit

Permalink
feat: add test for tls memcached
Browse files Browse the repository at this point in the history
  • Loading branch information
wangrui committed Jan 2, 2025
1 parent 59bc4a2 commit c215fe0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ OPENDAL_SLED_TREE=sled-tree
# memcached
OPENDAL_MEMCACHED_ENDPOINT=tcp://127.0.0.1:11211
OPENDAL_MEMCACHED_ROOT=/
OPENDAL_MEMCACHED_ENABLE_TLS=true
OPENDAL_MEMCACHED_TLS_KEY=/
OPENDAL_MEMCACHED_TLS_CERT=/
# webdav
OPENDAL_WEBDAV_ROOT=/tmp/opendal/
OPENDAL_WEBDAV_ENDPOINT=http://127.0.0.1:8080
Expand Down
8 changes: 8 additions & 0 deletions core/src/services/memcached/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ impl Builder for MemcachedBuilder {
);
};
if self.config.enable_tls {
rustls::crypto::aws_lc_rs::default_provider()
.install_default()
.map_err(|_err| {
Error::new(
ErrorKind::Unexpected,
"no process-level CryptoProvider available",
)
})?;
ServerName::try_from(host.clone()).map_err(|err| {
Error::new(ErrorKind::ConfigInvalid, "Invalid dns name error")
.with_context("service", Scheme::Memcached)
Expand Down

0 comments on commit c215fe0

Please sign in to comment.