Project

Profile

Help

Story #3943

closed

Issue #3981: Switch Pulp3 settings to Dynaconf

As a user, I can configure Pulp using environment variables

Added by bmbouter almost 6 years ago. Updated over 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Category:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

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.

Solution

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

$ cat settings.py

# get lots of data from ENVIRONMENT variables
PULP_SETTINGS = {}  # 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

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.

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.

Also available in: Atom PDF