Project

Profile

Help

Story #3943

Updated by bmbouter over 5 years ago

h2. Problem Statement 

 While trying to get Pulp3 running on Openshift I ran into an issue where I needed to set a setting in the settings.yaml file from an environment variable. For example the IP of the postgresql instance is only known to openshift and available via an enviornment variable. 

 This is a blocker on deploying Pulp3 into Openshift. 

 h2. Solution 

 Make our settings file a python module instead with the config available at as a module attribute named 'PULP_CONFIG', e.g. 

 <pre> 
 $ cat settings.py 

 # get lots of data from ENVIRONMENT variables 
 PULP_SETTINGS PULP_CONFIG = {}    # This would be the toplevel dictionary that would overwrite _DEFAULT_PULP_SETTINGS 
 # _DEFAULT_PULP_SETTINGS is here:    https://github.com/pulp/pulp/blob/master/pulpcore/pulpcore/app/settings.py#L163 
 </pre> 

 h4. How will the conf file be imported? 

 Same way as today, first an environment variable is checked which contains a full path to the python module. If that environment variable isn't set it defaults to look to /etc/pulp/settings.py 

 The only change is /etc/pulp/server.yaml to /etc/pulp/settings.py as the default location accessed. 

 h4. What happens if Pulp finds no settings file or no PULP_SETTINGS attribute in there. It has to fail because Pulp requires the settings file to read the value of SECRET_KEY which we can never ship.

Back