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.
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: System.get_env("EX_OVH_ENDPOINT"),
api_version: System.get_env("EX_OVH_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.
EX_OVH_ENDPOINT
: The system environment variable name for the ovh endpoint.
EX_OVH_API_VERSION
: The system environment variable name for the api version.
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
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 57 58 59 60 61 62 63 64 65 66 67 68 69
# 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:**
```shell
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:**
```elixir
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: System.get_env("EX_OVH_ENDPOINT"),
api_version: System.get_env("EX_OVH_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.
- `EX_OVH_ENDPOINT`: The system environment variable name for the ovh endpoint.
- `EX_OVH_API_VERSION`: The system environment variable name for the api version.
- 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.
```shell
source .env
```