From 038bdc0dde86fffa466f5e79d64a5f6fc87e8805 Mon Sep 17 00:00:00 2001 From: Peter Tihanyi Date: Fri, 14 Apr 2023 09:29:20 +0200 Subject: [PATCH] Start ssl when using secure connection with riakc_pb --- Makefile | 4 ++-- src/basho_bench_driver_riakc_pb.erl | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 8beab1f9a..075c9f2e4 100644 --- a/Makefile +++ b/Makefile @@ -6,12 +6,12 @@ PKG_ID = basho-bench-$(PKG_VERSION) PKG_BUILD = 1 BASE_DIR = $(shell pwd) ERLANG_BIN = $(shell dirname $(shell which erl)) -REBAR ?= $(BASE_DIR)/rebar +REBAR ?= $(BASE_DIR)/rebar3 OVERLAY_VARS ?= all: deps compile - $(REBAR) skip_deps=true escriptize + $(REBAR) escriptize .PHONY: deps compile rel lock locked-all locked-deps diff --git a/src/basho_bench_driver_riakc_pb.erl b/src/basho_bench_driver_riakc_pb.erl index 2814c0907..b040ebe15 100644 --- a/src/basho_bench_driver_riakc_pb.erl +++ b/src/basho_bench_driver_riakc_pb.erl @@ -128,7 +128,13 @@ new(Id) -> Targets = basho_bench_config:normalize_ips(Ips, Port), {TargetIp, TargetPort} = lists:nth((Id rem length(Targets)+1), Targets), ?INFO("Using target ~p:~p for worker ~p\n", [TargetIp, TargetPort, Id]), - case riakc_pb_socket:start_link(TargetIp, TargetPort, get_connect_options()) of + + Options = get_connect_options(), + case proplists:is_defined(cacertfile, Options) of + true -> ssl:start(); + _ -> ok + end, + case riakc_pb_socket:start_link(TargetIp, TargetPort, Options) of {ok, Pid} -> NominatedID = Id == 1, {ok, #state { pid = Pid,