kmx.io/ex_ovh/docs/getting_started_advanced.md

Download

Getting Started (Advanced)

Installation

defp deps() do
  [{:ex_ovh, "~> 0.0.1"}]
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

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: System.get_env("MY_APP_OVH_CLIENT_ENDPOINT"),
     api_version: System.get_env("MY_APP_OVH_CLIENT_API_VERSION") || "1.0"
   ]

In the example below, MY_APP_OVH_CLIENT_WEBSTORAGE_CDN_NAME is added to the environment variables.

config :ex_ovh,
  ovh: [],
  swift: [
        webstorage: [
                      cdn_name: System.get_env("MY_APP_OVH_CLIENT_WEBSTORAGE_CDN_NAME"),
                      type: :webstorage
                    ]
       ]

In the example below, MY_APP_OVH_CLIENT_CLOUDSTORAGE_TENANT_ID and MY_APP_OVH_CLIENT_CLOUDSTORAGE_USER_ID are added to the environment variables.

config :ex_ovh,
  ovh: [],
  swift: [
        cloudstorage: [
                        tenant_id: System.get_env("MY_APP_OVH_CLIENT_CLOUDSTORAGE_TENANT_ID"), # mandatory, corresponds to a project id
                        user_id: System.get_env("MY_APP_OVH_CLIENT_CLOUDSTORAGE_USER_ID"), # optional, if absent a user will be created using the ovh api.
                        account_temp_url_key: System.get_env("MY_APP_OVH_CLIENT_CLOUDSTORAGE_TEMP_URL_KEY"), # defaults to :nil if absent and won't be added if == :nil.
                        keystone_endpoint: "https://auth.cloud.ovh.net/v2.0", # default endpoint for keystone (identity) auth
                        region: :nil, # defaults to "SBG1" if set to :nil
                        type: :cloudstorage
                      ]
       ]
config :openstex,
  httpoison: [
              connect_timeout: 30000, # 30 seconds
              receive_timeout: (60000 * 30) # 30 minutes
             ]

Source

Download