Closed jorgejesus closed 4 years ago
Suggestion for implementation: @francbartoli I’ve used this package in the past https://configurator.readthedocs.io/en/latest/patterns.html#config-file-overlaid-with-environment-variables
@tomkralidis Another suggestion is to code en stackoverflow that can replace the yaml variables https://stackoverflow.com/questions/52412297/how-to-replace-environment-variable-value-in-yaml-file-to-be-parsed-using-python/52412796#52412796
I have a similar use case (e.g. I want to pass configuration in via environment variables).
@jorgejesus -- If you're already working on this, I'll refrain from working on this. Otherwise, I'm up for taking on the implementation of this.
An alternative strategy is to implement something like an inheritance model, like Docker Compose does: docker-compose -f docker-compose.base.yml -f docker-compose.dev.yml build service
where the second configuration (docker-compose.yml
) only contains information that overrides key/values in the first configuration. I use that pattern frequently; I commit the base configuration, but not the configuration for a particular stage (since it's where I keep secrets). I find this easier than working with environment variables, as it's more portable and I don't need to worry about collisions. It would also allow for configurations to be split into multiple files as a secondary advantage.
@ayan-usgs Thank you for the info that you are implementing thing, if you are working on this ticket please go ahead and change the ticket to inprogress
, I will not go ahead
Looks like @tomkralidis already has a PR for this. :smile:
Is your feature request related to a problem? Please describe.
devop systems (docker, k8) use enviroment variable to set parameters like database connections of set passwords inside containers.
For example running pygeopai in openshift and we want to connect to a database that has a secret password. Currentely we would have to set the password on the yaml configuration file and this could be a security problem, while openshift can set the secret env inside the pod from a secure source
Describe the solution you'd like Parse the PYGEOAPI_CONFIG yaml file with python module envyaml (https://github.com/thesimj/envyaml). The current default module yaml should be replaced by envyaml as parser allowing for env variables to be injected into the yaml file
Describe alternatives you've considered The dataprovider would get the env variables by it self, IMHO this is less elegant and we may need the described solutions for other configurations
Additional context Add any other context or screenshots about the feature request here.![image](https://user-images.githubusercontent.com/1275400/65626708-2cd62700-dfce-11e9-9926-ae7e1a193b31.png)