Hash :
dc63c2ec
Author :
Date :
2016-04-24T14:34:18
starting migration from old version of ex_ovh to new version.
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
defmodule ExOvh.Client do
@moduledoc ~S"""
"""
alias ExOvh.Defaults
defmacro __using__(opts) do
quote bind_quoted: [opts: opts] do
@otp_app Keyword.get(opts, :otp_app, :ex_ovh)
use Openstex.Client, client: __MODULE__, swift_cache: __MODULE__.Auth.Openstack.Swift.Cache
# Incorporation of the Swift Oject Storage Helpers modules.
defmodule Helpers.Swift do
%Macro.Env{context_modules: [_, client_module]} = __ENV__
use Openstex.Helpers.V1.Swift, client: client_module
end
# Incorporation of the Custom Ovh Helpers modules.
defmodule Helpers.Ovh do
%Macro.Env{context_modules: [_, _, client_module]} = __ENV__
use ExOvh.Ovh.V1.Webstorage.Helpers, client: client_module
end
if (@otp_app != :ex_ovh) do
def config(), do: Application.get_env(@otp_app, __MODULE__)
|> Keyword.fetch!(:ovh)
else
def config(), do: Application.get_all_env(@otp_app)
|> Keyword.fetch!(:ovh)
end
def start_link(opts \\ []) do
ExOvh.Supervisor.start_link(__MODULE__, config(), opts)
end
end
end
@doc ~s"""
Starts the ovh supervisors.
"""
@callback start_link() :: :ok | {:error, {:already_started, pid}} | {:error, term}
@doc ~s"""
Gets the ovh config from the application environment.
"""
@callback config() :: :nil | map
end