kmx.io/ex_ovh/docs/getting_started_advanced.md

Download

Getting Started (Advanced)

Installation

defp deps() do
  [{:ex_ovh, "~> 0.0.1"}]
end

Configuration

Note: The configuration assumes that the environment variables such as MY_APP_OVH_CLIENT_CLIENT_ID are already created.

config :my_app, MyApp.OvhClient,
   ovh: [
     application_key: System.get_env("MY_APP_OVH_CLIENT_APPLICATION_KEY"),
     application_secret: System.get_env("MY_APP_OVH_CLIENT_APPLICATION_SECRET"),
     consumer_key: System.get_env("MY_APP_OVH_CLIENT_CONSUMER_KEY"),
     endpoint: "ovh-eu",
     api_version: "1.0"
   ],
   httpoison: [ # optional
     connect_timeout: 20000,
     receive_timeout: 100000
   ]
def application do
 [applications: [:ex_ovh]]
end
defmodule MyApp.OvhClient do
  @moduledoc :false
  use ExOvh.Client, otp_app: :my_app, client: __MODULE__
end
def start(_type, _args) do
  import Supervisor.Spec, warn: false
  spec1 = [supervisor(MyApp.Endpoint, [])]
  spec2 = [supervisor(MyApp.OvhClient, [])]
  opts = [strategy: :one_for_one, name: MyApp.Supervisor]
  Supervisor.start_link(spec1 ++ spec2, opts)
end

Source

Download