From 513952bde418e8370471a21814c1bcaffd36fef1 Mon Sep 17 00:00:00 2001 From: Brian Bouterse Date: Wed, 16 Oct 2019 16:11:25 -0400 Subject: [PATCH] Remove hard coded `/etc/pulp/settings.py` file This changes Pulp to not assume any settings file is needed or looked for at all. It encourages the user to set one via the `PULP_SETTINGS` Environment Variable. The settings documentation was updated to reflect this. The Installer will continue working as is. The PR below causes the installer to set `PULP_SETTINGS` correctly allowing settings to work the same way in those environments. Required PR: https://github.com/pulp/ansible-pulp/pull/182 https://pulp.plan.io/issues/5560 closes #5560 --- CHANGES/5560.feature | 1 + docs/installation/configuration.rst | 25 ++++++++++++++++++------- pulpcore/app/settings.py | 2 -- 3 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 CHANGES/5560.feature diff --git a/CHANGES/5560.feature b/CHANGES/5560.feature new file mode 100644 index 0000000000..675b6567d9 --- /dev/null +++ b/CHANGES/5560.feature @@ -0,0 +1 @@ +Users specify Pulp settings file locaiton and type using `PULP_SETTINGS` environment variable. diff --git a/docs/installation/configuration.rst b/docs/installation/configuration.rst index ebbe0704cd..5266c85b21 100644 --- a/docs/installation/configuration.rst +++ b/docs/installation/configuration.rst @@ -10,10 +10,20 @@ to configure Pulp in a few ways: By Configuration File --------------------- -Non-default settings can be specified in the ``/etc/pulp/settings.py``. The presence of this file is -optional. The expected location and format can be changed by specifying the ``PULP_SETTINGS`` -environment variable. Dynaconf supports `settings in multiple file formats `_ +To configure Pulp by settings file, you must set the format and location of the config file by +specifying the ``PULP_SETTINGS`` environment variable. For example, if you wanted to use Python to +specify your configuration, and provide it at ``/etc/pulp/settings.py`` you could:: + + export PULP_SETTINGS=/etc/pulp/settings.py + + +Or in a systemd file you could:: + + Environment="PULP_SETTINGS=/etc/pulp/settings.py" as the Ansible Installer does. + + +Dynaconf supports `settings in multiple file formats `_ This file should have permissions of: @@ -32,9 +42,10 @@ If it is in its own directory like ``/etc/pulp``, the directory should have perm By Environment Variables ------------------------ -Each of the settings can also be configured using Dynaconf by prepending ``PULP_`` to the name of -the setting and specifying that as an environment variable. For example the ``SECRET_KEY`` can be -specified by exporting the ``PULP_SECRET_KEY`` variable. +Many users specify their Pulp settings entirely by Environment Variables. Each of the settings can +be configured using Dynaconf by prepending ``PULP_`` to the name of the setting and specifying that +as an Environment Variable. For example the ``SECRET_KEY`` can be specified by exporting the +``PULP_SECRET_KEY`` variable. Settings diff --git a/pulpcore/app/settings.py b/pulpcore/app/settings.py index 6cb537ba1f..a7bb5f1a74 100644 --- a/pulpcore/app/settings.py +++ b/pulpcore/app/settings.py @@ -230,8 +230,6 @@ INCLUDES_FOR_DYNACONF=[ '{}.app.settings'.format(plugin_name) for plugin_name in INSTALLED_PULP_PLUGINS - ] + [ - "/etc/pulp/settings.py" ], ENVVAR_FOR_DYNACONF='PULP_SETTINGS', )