Allow user to specify a configuration file in VMPOOLER_CONFIG_FILE

variable

Previously, there were two ways to configure Vmpooler, either by
changing the contents of vmpooler.yaml or by assigning the raw YAML
to the VMPOOLER_CONFIG environment variable. This commit adds a new
environment variable called VMPOOLER_CONFIG_FILE that can be assigned
the name of a config file to use. Also fixes #240 by whitelisting the
Symbol class when calling YAML.safe_load in Vmpooler.config.
This commit is contained in:
adamdav 2017-10-06 17:09:31 -07:00 committed by mattkirby
parent 28922df28e
commit 878c93f646
8 changed files with 152 additions and 13 deletions

View file

@ -62,17 +62,25 @@ C:\vmpooler > $ENV:VMPOOLER_DEBUG = 'true'
### `VMPOOLER_CONFIG`
When `VMPOOLER_CONFIG` is set, vmpooler will read its configuration from the content of the environment variable instead of from the `vmpooler.yaml` configuration file.
When `VMPOOLER_CONFIG` is set, vmpooler will read its configuration from the content of the environment variable.
Note that this variable does not point a different configuration file, but stores the contents of a configuration file.
Note that this variable does not point to a different configuration file, but stores the contents of a configuration file. You may use `VMPOOLER_CONFIG_FILE` instead to specify a filename.
### `VMPOOLER_CONFIG_FILE`
When `VMPOOLER_CONFIG_FILE` is set, vmpooler will read its configuration from the file specified in the environment variable.
Note that this variable points to a different configuration file, unlike `VMPOOLER_CONFIG`.
## Setup vmpooler Configuration
You can either create a `vmpooler.yaml` file or set the `VMPOOLER_CONFIG` environment variable with the equivalent content.
You can create a `vmpooler.yaml` file, set the `VMPOOLER_CONFIG` environment variable with the equivalent content, or set the `VMPOOLER_CONFIG_FILE` environment variable with the name of another configuration file to use. `VMPOOLER_CONFIG` takes precedence over `VMPOOLER_CONFIG_FILE`.
Example minimal configuration file:
```yaml
---
:providers:
:dummy: