Mix Task (Basic)

Generate ExOvh Config

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

  • The mix task:

    1. Creates an application on the user's behalf by sending http requests using the user's username and password credentials.
    2. Gets a consumer key and validation url.
    3. Validates the validation url on the user's behalf by sending http requests using the user's username and password credentials.
    4. Adds the application key, application secret and associated consumer key to the environment configuration.

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.

Shell input:

mix ovh \
--login=<username-ovh> \
--password=<password> \
--appname='ex_ovh'
  • login: username/nic_handle for logging into OVH services. Note: must include -ovh at the end of the string.
  • password: password for logging into OVH services.
  • appname: this should correspond to the otp_app name in the elixir application. It also doubles as the application name for the application in the OVH servers.
  • redirecturi: defaults to "" when absent.
  • endpoint: defaults to "ovh-eu" wen absent.
  • accessrules: defaults to get-[/*]::put-[/*]::post-[/*]::delete-[/*] when absent giving the application all full priveleges. One may consider fine-tuning the accessrules, see advanced example below.
  • appdescription: defaults to appname if absent
  • clientname:" This is the elixir client name. defaults to ExOvh when the appname is exactly equal to ex_ovh, otherwise defaults to OvhClient.

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:

  • EX_OVH_APPLICATION_KEY: The system environment variable name for the application key.
  • EX_OVH_APPLICATION_SECRET: The system environment variable name for the application secret.
  • EX_OVH_CONSUMER_KEY: The system environment variable name for the consumer key.

  • Copy the configuration outputted by the commandline to config.exs.

  • The enviroment variables are saved to a file called .env automatically by the mix task. Do not add the .env file to version control. Add the variables to the system environment by running the command or some other commands as appropriate to the deployment method.

source .env