diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/powerdnsex.ex | 2 | ||||
-rw-r--r-- | lib/powerdnsex/config.ex | 5 | ||||
-rw-r--r-- | lib/powerdnsex/http_client.ex | 6 |
3 files changed, 11 insertions, 2 deletions
diff --git a/lib/powerdnsex.ex b/lib/powerdnsex.ex index 6568319..86628b7 100644 --- a/lib/powerdnsex.ex +++ b/lib/powerdnsex.ex @@ -98,5 +98,5 @@ defmodule PowerDNSex do # Private # ########### - defp call(params), do: GenServer.call(@name, params) + defp call(params), do: GenServer.call(@name, params, Config.powerdns_timeout) end diff --git a/lib/powerdnsex/config.ex b/lib/powerdnsex/config.ex index 34d5889..1302524 100644 --- a/lib/powerdnsex/config.ex +++ b/lib/powerdnsex/config.ex @@ -1,6 +1,7 @@ defmodule PowerDNSex.Config do defstruct url: "", - token: "" + token: "", + timeout: "60" alias PowerDNSex.Config @@ -20,6 +21,8 @@ defmodule PowerDNSex.Config do def powerdns_token, do: data().token + def powerdns_timeout, do: :timer.seconds(data().timeout) + def valid?(), do: powerdns_url() && powerdns_token() ### diff --git a/lib/powerdnsex/http_client.ex b/lib/powerdnsex/http_client.ex index 13e5023..3431795 100644 --- a/lib/powerdnsex/http_client.ex +++ b/lib/powerdnsex/http_client.ex @@ -13,4 +13,10 @@ defmodule PowerDNSex.HttpClient do custom = ["X-API-Key": Config.powerdns_token()] Keyword.merge(headers, custom) end + + def process_request_options(options) do + custom_options = [ssl: [{:versions, [:'tlsv1.1']}], recv_timeout: Config.powerdns_timeout()] + Keyword.merge(options, custom_options) + end + end |