kmx.io/ex_ovh/docs/mix_task.md

Branch

Download

Mix Task

Generate ExOvh Config

The ovh mix task makes requests to the OVH API on the user’s behalf to generate an OVH application.

The environment variables generated by the task are automatically save to a .env file. It is best to ensure that this file is outside version control.

Example 1

Shell input:

mix ovh --login=<username-ovh> --password=<password> --appname='my_app_name'

Shell Output:

config :ex_ovh,
  ovh: [
    application_key: System.get_env("EX_OVH_APPLICATION_KEY"),
    application_secret: System.get_env("EX_OVH_APPLICATION_SECRET"),
    consumer_key: System.get_env("EX_OVH_CONSUMER_KEY"),
    endpoint: "ovh-eu",
    api_version: "1.0"
  ]

Terms explained:

Example 2

Shell Input:

mix ovh \
--login=<username-ovh> \
--password=<password> \
--appdescription='Ovh Application for my app' \
--endpoint='ovh-eu' \
--apiversion='1.0' \
--redirecturi='http://localhost:4000/' \
--accessrules='get-[/*]::put-[/me,/me/*,/cdn/webstorage,/cdn/webstorage/*]::post-[/me,/cdn/webstorage,/cdn/webstorage/*]::delete-[/cdn/webstorage,/cdn/webstorage/*]' \
--appname='my_app' \
--clientname='OvhClient'

Shell Output:

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"
    ]

Terms explained:

Add the settings to the environment

source .env

Source

Download