Skip to content

Commit

Permalink
Remove hard coded /etc/pulp/settings.py file
Browse files Browse the repository at this point in the history
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: pulp/pulp_installer#182

https://pulp.plan.io/issues/5560
closes #5560
  • Loading branch information
bmbouter committed Oct 17, 2019
1 parent c4411d9 commit 513952b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGES/5560.feature
@@ -0,0 +1 @@
Users specify Pulp settings file locaiton and type using `PULP_SETTINGS` environment variable.
25 changes: 18 additions & 7 deletions docs/installation/configuration.rst
Expand Up @@ -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 <https://dynaconf.
readthedocs.io/en/latest/guides/examples.html>`_
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 <https://dynaconf.readthedocs.io/en/latest/
guides/examples.html>`_

This file should have permissions of:

Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions pulpcore/app/settings.py
Expand Up @@ -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',
)
Expand Down

0 comments on commit 513952b

Please sign in to comment.