diff options
author | Jordan Bracco <href@random.sh> | 2021-04-25 21:07:53 +0200 |
---|---|---|
committer | Jordan Bracco <href@random.sh> | 2021-04-25 21:07:53 +0200 |
commit | 6485393e81cd3527251a8a0ba5a60c1c9229a3fb (patch) | |
tree | f6c356776e0b7c49dad6b3dc78274b2f374730f1 /lib/azure_ex/token_hosting.ex | |
parent | Update deps lock (diff) |
wipdevelop
Diffstat (limited to 'lib/azure_ex/token_hosting.ex')
-rw-r--r-- | lib/azure_ex/token_hosting.ex | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/azure_ex/token_hosting.ex b/lib/azure_ex/token_hosting.ex index 6c0a4c8..04c859c 100644 --- a/lib/azure_ex/token_hosting.ex +++ b/lib/azure_ex/token_hosting.ex @@ -39,8 +39,7 @@ defmodule AzureEx.TokenHosting do } end - def start_link(opts \\ []) do - name = Keyword.get(opts, :name, __MODULE__) + def start_link(opts \\ [], start_opts \\ []) do tenant = Keyword.get(opts, :tenant) client_id = Keyword.get(opts, :client_id) client_secret = Keyword.get(opts, :client_secret) @@ -48,7 +47,7 @@ defmodule AzureEx.TokenHosting do {:ok, token} = apply_token(params) - GenServer.start_link(__MODULE__, %{params: params, token: token}, name: name) + GenServer.start_link(__MODULE__, %{params: params, token: token}, start_opts) end @scope "https://management.azure.com//.default" @@ -89,7 +88,11 @@ defmodule AzureEx.TokenHosting do {:ok, state} end - def get_token do + def get_process_token() do + GenServer.call(Process.get(__MODULE__), :get) + end + + def get_token(name) do GenServer.call(__MODULE__, :get) end |