summaryrefslogtreecommitdiff
path: root/p11p-daemon/src/p11p_config.erl
diff options
context:
space:
mode:
authorLinus Nordberg <linus@sunet.se>2020-02-17 15:54:35 +0100
committerLinus Nordberg <linus@sunet.se>2020-02-17 15:54:35 +0100
commitacda4bf3fd4ed82d0545923e1c9b100a26f0a92b (patch)
tree9230e8501df26795b6dbc2ca775a65857e500a01 /p11p-daemon/src/p11p_config.erl
parent4211a9bc22f274107997189514031141b2664b94 (diff)
Make the $PID part of socket names configurable
Diffstat (limited to 'p11p-daemon/src/p11p_config.erl')
-rw-r--r--p11p-daemon/src/p11p_config.erl14
1 files changed, 14 insertions, 0 deletions
diff --git a/p11p-daemon/src/p11p_config.erl b/p11p-daemon/src/p11p_config.erl
index 12a90b9..2ee578b 100644
--- a/p11p-daemon/src/p11p_config.erl
+++ b/p11p-daemon/src/p11p_config.erl
@@ -14,6 +14,7 @@
nameof/1,
proxyapp_bin_path/0,
socket_dir/0,
+ socket_path_has_pid/0,
testing_drop_prob/0,
tokens/0,
token_balance/1,
@@ -39,6 +40,7 @@
-record(state, {
socket_dir :: string(),
+ socket_path_has_pid :: boolean(),
proxyapp_bin_path :: string(),
testing_drop_prob :: non_neg_integer(),
tokens :: #{string() => token()}
@@ -57,6 +59,8 @@ handle_call(proxyapp_bin_path, _From, S = #state{proxyapp_bin_path = Path}) ->
{reply, Path, S};
handle_call(socket_dir, _From, S = #state{socket_dir = Dir}) ->
{reply, Dir, S};
+handle_call(socket_path_has_pid, _From, S = #state{socket_path_has_pid = B}) ->
+ {reply, B, S};
handle_call(testing_drop_prob, _From, S = #state{testing_drop_prob = P}) ->
{reply, P, S};
handle_call(tokens, _From, State = #state{tokens = Tokens}) ->
@@ -102,6 +106,9 @@ proxyapp_bin_path() ->
socket_dir() ->
gen_server:call(?MODULE, socket_dir).
+socket_path_has_pid() ->
+ gen_server:call(?MODULE, socket_path_has_pid).
+
testing_drop_prob() ->
gen_server:call(?MODULE, testing_drop_prob).
@@ -148,6 +155,9 @@ init_state() ->
socket_dir = application:get_env(p11p,
socket_dir,
default_socket_dir()),
+ socket_path_has_pid = application:get_env(p11p,
+ socket_path_has_pid,
+ true),
proxyapp_bin_path = application:get_env(p11p,
proxyapp_bin_path,
?PROXYAPP_DEFAULT),
@@ -164,6 +174,10 @@ init_state(Filename) ->
string,
"socket_dir",
default_socket_dir()),
+ socket_path_has_pid = p11p_config_file:get(Config,
+ bool,
+ "socket_path_has_pid",
+ true),
proxyapp_bin_path = p11p_config_file:get(Config,
string,
"proxyapp_bin_path",