diff options
Diffstat (limited to 'p11p-daemon/src')
-rw-r--r-- | p11p-daemon/src/p11p_config.erl | 10 | ||||
-rw-r--r-- | p11p-daemon/src/p11p_remote.erl | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/p11p-daemon/src/p11p_config.erl b/p11p-daemon/src/p11p_config.erl index 23b79bb..6c4cfb6 100644 --- a/p11p-daemon/src/p11p_config.erl +++ b/p11p-daemon/src/p11p_config.erl @@ -6,7 +6,7 @@ %%-export([config/0]). -export([nameof/1]). -export([tokens/0]). --export([modules_for_token/1, module_path/1, token_mode/1]). +-export([remotebin_path/0, modules_for_token/1, module_path/1, token_mode/1]). -export_type([token_mode_t/0]). %% Genserver callbacks. @@ -31,6 +31,7 @@ %% Genserver state. -record(state, { + remotebin_path :: string(), tokens :: #{string() => token()} }). @@ -42,6 +43,9 @@ start_link() -> %% config() -> %% gen_server:call(?MODULE, config). +remotebin_path() -> + gen_server:call(?MODULE, remotebin_path). + -spec tokens() -> [token()]. tokens() -> gen_server:call(?MODULE, tokens). @@ -73,6 +77,8 @@ init(_Args) -> %% handle_call(config, _From, State) -> %% {reply, State, State}; +handle_call(remotebin_path, _From, #state{remotebin_path = Path} = State) -> + {reply, Path, State}; handle_call(tokens, _From, #state{tokens = Tokens} = State) -> {reply, maps:values(Tokens), State}; handle_call({modules_for_token, TokName}, _, #state{tokens = Tokens} = S) -> @@ -104,6 +110,8 @@ code_change(_OldVersion, State, _Extra) -> init_state() -> #state { + remotebin_path = application:get_env(p11p, remotebin_path, + "/usr/local/libexec/p11-kit/p11-kit-remote"), tokens = conf_tokens(application:get_env(p11p, groups, [])) }. diff --git a/p11p-daemon/src/p11p_remote.erl b/p11p-daemon/src/p11p_remote.erl index 158b427..86e3471 100644 --- a/p11p-daemon/src/p11p_remote.erl +++ b/p11p-daemon/src/p11p_remote.erl @@ -59,7 +59,7 @@ stop(Pid, Reason) -> %% Genserver callbacks. init([TokName, ModPath]) -> - Port = open_port({spawn_executable, ?P11KITREMOTE_PATH}, + Port = open_port({spawn_executable, p11p_config:remotebin_path()}, [stream, exit_status, {args, [ModPath, "-v"]}]), lager:debug("~p: ~s: new remote port: ~p", [self(), ?P11KITREMOTE_PATH, Port]), {ok, #state{port = Port, token = TokName}}. |