fixes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
diff --git a/docs/getting_started_advanced.md b/docs/getting_started_advanced.md
index 6063aac..5837749 100644
--- a/docs/getting_started_advanced.md
+++ b/docs/getting_started_advanced.md
@@ -92,4 +92,13 @@ config :openstex,
connect_timeout: 30000, # 30 seconds
receive_timeout: (60000 * 30) # 30 minutes
]
+```
+
+- Add the client to your project.
+
+```elixir
+defmodule MyApp.OvhClient do
+ @moduledoc :false
+ use ExOvh.Client, otp_app: :my_app
+end
```
\ No newline at end of file
diff --git a/lib/client.ex b/lib/client.ex
index e812f87..23a273f 100644
--- a/lib/client.ex
+++ b/lib/client.ex
@@ -108,8 +108,10 @@ defmodule ExOvh.Client do
ExOvh.Supervisor.start_link(__MODULE__, sup_opts)
end
+
# client definitions
+
defmodule Ovh do
@moduledoc ExOvh.Client.ovh_docs()
use Openstex.Client, client: __MODULE__
@@ -127,6 +129,7 @@ defmodule ExOvh.Client do
end
end
+
defmodule Swift.Webstorage do
@moduledoc ExOvh.Client.swift_docs()
use Openstex.Client, client: __MODULE__
@@ -141,9 +144,9 @@ defmodule ExOvh.Client do
@doc "Returns the swift account string."
@spec account() :: String.t
def account(), do: __MODULE__.cache().get_swift_account(__MODULE__)
-
end
+
defmodule Swift.Cloudstorage do
@moduledoc ExOvh.Client.swift_docs()
use Openstex.Client, client: __MODULE__
@@ -161,9 +164,9 @@ defmodule ExOvh.Client do
@doc "Returns the swift account string."
@spec account() :: String.t
def account(), do: __MODULE__.cache().get_swift_account(__MODULE__)
-
end
+
end
end
diff --git a/lib/ovh/v1/cloud/query.ex b/lib/ovh/v1/cloud/query.ex
index c342932..845e0ff 100644
--- a/lib/ovh/v1/cloud/query.ex
+++ b/lib/ovh/v1/cloud/query.ex
@@ -584,7 +584,7 @@ defmodule ExOvh.Ovh.V1.Cloud.Query do
"""
@spec create_project_alert(String.t, String.t, integer, String.t) :: Query.t | no_return
def create_project_alert(service_name, email, monthly_threshold, delay \\ "3600") do
- unless is_integer(monthly_threshold), do: Og.log_return(__ENV__, "monthly_threshold should be an integer!", :error) |> raise()
+ unless is_integer(monthly_threshold), do: Og.log_return("monthly_threshold should be an integer!", __ENV__, :error) |> raise()
%Query{
method: :post,
uri: "/cloud/project/#{service_name}/alerting",
@@ -644,7 +644,7 @@ defmodule ExOvh.Ovh.V1.Cloud.Query do
"""
@spec modify_project_alert(String.t, String.t, String.t, integer, String.t) :: Query.t
def modify_project_alert(service_name, alert_id, email, monthly_threshold, delay \\ "3600") do
- unless is_integer(monthly_threshold), do: Og.log_return(__ENV__, "monthly_threshold should be an integer!", :error) |> raise()
+ unless is_integer(monthly_threshold), do: Og.log_return("monthly_threshold should be an integer!", __ENV__, :error) |> raise()
%Query{
method: :put,
uri: "/cloud/project/#{service_name}/alerting/#{alert_id}",
diff --git a/lib/supervisor.ex b/lib/supervisor.ex
index 0d19fbf..8e8cc7b 100644
--- a/lib/supervisor.ex
+++ b/lib/supervisor.ex
@@ -26,7 +26,11 @@ defmodule ExOvh.Supervisor do
webstorage_config = Keyword.get(client.config(), :swift, []) |> Keyword.get(:webstorage, :nil)
cloudstorage_config = Keyword.get(client.config(), :swift, []) |> Keyword.get(:cloudstorage, :nil)
- |> Keyword.merge(Defaults.cloudstorage(), fn(_k, v1, v2) -> if v1 == :nil, do: v2, else: v1 end)
+ cloudstorage_config =
+ case cloudstorage_config do
+ :nil -> :nil
+ _ -> Keyword.merge(cloudstorage_config, Defaults.cloudstorage(), fn(_k, v1, v2) -> if v1 == :nil, do: v2, else: v1 end)
+ end
ovh_client = Module.concat(client, Ovh)
sup_tree = [