Problem: Pulp can't be configured using environment variables #3663
Conversation
|
Hello @dkliban! Thanks for updating the PR.
Comment last updated on September 24, 2018 at 21:04 Hours UTC |
ebb4d24
to
a353d1a
Compare
Codecov Report
@@ Coverage Diff @@
## master #3663 +/- ##
==========================================
- Coverage 55.93% 55.79% -0.14%
==========================================
Files 62 63 +1
Lines 2703 2690 -13
==========================================
- Hits 1512 1501 -11
+ Misses 1191 1189 -2
Continue to review full report at Codecov.
|
0da1fd4
to
62ea0af
Compare
docs/installation/configuration.rst
Outdated
| Pulp uses `dynaconf <https://dynaconf.readthedocs.io/en/latest/>`_ for its settings. dynaconf | ||
| allows storing `settings in multiple file formats <https://dynaconf.readthedocs | ||
| .io/en/latest/guides/examples.html>`_. The location of the settings file is specified by setting | ||
| the ``PULP_SETTINGS`` environment variable. Each of the settings can also be set by prepending |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like there should be a default settings file location so a user won't necessarily have to muck with env vars if they don't want to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I file a RFE with dynaconf for this feature. dynaconf/dynaconf#87
| CONTENT = { | ||
| 'HOST': None, | ||
| 'WEB_SERVER': 'django', | ||
| 'REDIRECT': { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious about how to define CONTENT and CONTENT['REDIRECT'] as environment vars?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@daviddavis @dkliban there are 2 ways.
- TOML (recommended)
When reading environment variables dynaconf will always parse as a TOML value, so
$ export PULP_FOO="{ name = 'Bruno', number = 42 }"
$ dynaconf list -k foo
{
'name': 'Bruno',
'number': 42
}https://github.com/toml-lang/toml#inline-table
@casting (deprecated)
Previous versions of dynaconf used a specisl @ casting (that was before the toml implementation) but still works
export PULP_FOO="@json {"name": "Bruno", "number": 42}"
export PULP_NUMBER="@float 73.5"There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
I'm a bit hesitant that we're adding new code and removing existing unit tests here without adding new ones. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a very beneficial change. Thanks for working on it. Left a few small suggestions.
65cb216
to
bc1e57c
Compare
Solution: use dynaconf to manage all of Pulp configuration settings This patch also adds pulpcore.rqconfig module that is dynamically generated from the Django settings generated by dynaconf. The rq workers use this module for their configuration. The default location of the config file is now at `/etc/pulp/settings.py`. Pulp can operate without by relying on environment variables. closes: pulp#3981 https://pulp.plan.io/issues/3981 closes: pulp#3879 https://pulp.plan.io/issues/3879 closes: pulp#3980 https://pulp.plan.io/issues/3980 closes pulp#3618 https://pulp.plan.io/issues/3618 closes: pulp#3943 https://pulp.plan.io/issues/3943
bc1e57c
to
e1fcdda
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Tested and it works great.
Solution: use dynaconf to manage all of Pulp configuration settings
This patch also adds pulpcore.rqconfig module that is dynamically generated from the Django settings
generated by dynaconf. The rq workers use this module for their configuration.
The default location of the config file is now at
/etc/pulp/settings.py. Pulp can operate without by relyingon environment variables.
closes: #3981
https://pulp.plan.io/issues/3981
closes: #3879
https://pulp.plan.io/issues/3879
closes: #3980
https://pulp.plan.io/issues/3980
closes #3618
https://pulp.plan.io/issues/3618
closes: #3943
https://pulp.plan.io/issues/3943