-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Support for Dynamic Settings #1837
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
backport-4.2
This PR should be backported to stable-4.2 (1.2)
backport-4.4
This PR should be backported to stable-4.4 (2.1)
backport-4.5
This PR should be backported to stable-4.5 (2.2)
backport-4.6
This PR should be backported to stable-4.6 (2.3)
backport-4.7
This PR should be backported to stable-4.7 (2.4)
labels
Aug 9, 2023
rochacbruno
removed
backport-4.2
This PR should be backported to stable-4.2 (1.2)
backport-4.4
This PR should be backported to stable-4.4 (2.1)
backport-4.5
This PR should be backported to stable-4.5 (2.2)
backport-4.6
This PR should be backported to stable-4.6 (2.3)
backport-4.7
This PR should be backported to stable-4.7 (2.4)
labels
Aug 9, 2023
rochacbruno
added a commit
to dynaconf/dynaconf
that referenced
this pull request
Aug 9, 2023
This PR allows changing the wrapped class with a class that allows hooks on specific methods. This will enable ansible/galaxy_ng#1837 This PR also fixes: #969
rochacbruno
added a commit
to dynaconf/dynaconf
that referenced
this pull request
Aug 9, 2023
This PR allows changing the wrapped class with a class that allows hooks on specific methods. This will enable ansible/galaxy_ng#1837 This PR also fixes: #969
rochacbruno
added a commit
to dynaconf/dynaconf
that referenced
this pull request
Aug 9, 2023
This PR allows changing the wrapped class with a class that allows hooks on specific methods. This will enable ansible/galaxy_ng#1837 This PR also fixes: #969
rochacbruno
force-pushed
the
new_dynamic_settings
branch
4 times, most recently
from
August 10, 2023 21:31
fdea3ad
to
441f981
Compare
rochacbruno
added a commit
to dynaconf/dynaconf
that referenced
this pull request
Aug 11, 2023
This PR allows changing the wrapped class with a class that allows hooks on specific methods. This will enable ansible/galaxy_ng#1837 This PR also fixes: #969
rochacbruno
force-pushed
the
new_dynamic_settings
branch
from
August 18, 2023 16:06
c40875f
to
6189e84
Compare
rochacbruno
force-pushed
the
new_dynamic_settings
branch
3 times, most recently
from
September 20, 2023 16:00
3dc80db
to
47cc64b
Compare
rochacbruno
force-pushed
the
new_dynamic_settings
branch
from
September 20, 2023 17:37
47cc64b
to
16ea3e8
Compare
rochacbruno
requested review from
jerabekjiri
and removed request for
bmclaughlin,
jctanner and
newswangerd
September 21, 2023 15:51
jerabekjiri
approved these changes
Sep 21, 2023
/retest |
slemrmartin
approved these changes
Nov 6, 2023
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.
👍 Awesome work
Requires Dynaconf 3.3 Issue: AAH-2009
Issue: AAH-2009
No-Issue
Issue: AAH-2009
Issue: AAH-2009
rochacbruno
force-pushed
the
new_dynamic_settings
branch
from
November 11, 2023 21:45
0b6ba17
to
5bad3e3
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: AAH-2009
Feature is deactivated by default,
to activate Requires Dynaconf 3.2.2
What this PR is doing?
This PR adds a new table to the models
config.Setting
, this table will storekey:value
pairs to be dynamically added to Dynaconf data and be available throughdjango.conf.settings
IMPORTANT key/value are stores in the database as
str
, upon access value can be read raw or parsed by dynaconf/toml, model also stores a timestampAlong with the model, the PR also adds a schema on
dynamic_settings.py:DYNACMIC_SETTINGS_SCHEMA
which defines which keys can be stored on the database, as we cannot allow all settings to be dynamic.A management command
django-admin galaxy-settings
is also added with commands toset,get,delete,list,inspect
the settings on the database.Every time a Setting is mutated on database it will also update a cache on Redis, if Redis is not available then caching will be skipped (and logged)
Finally, the PR adds a Dynaconf method hook to the
dynaconf:Settings:get
method, making access to any variables listed on the schema to trigger an immediate lookup oncache -> db
IMPORTANT this last feature requires Dynaconf 3.2.2 (to be released)NOTE The PR can be merged before Dynaconf 3.2.2 is released, there will be no breaking, only the feature n 5 will not be enabled.
GALAXY_DYNAMIC_SETTINGS=False
this is the main toggle for the feature n 5, this is by default set to False, which means,django.conf.settings
will lookup for keys in the cache/db only if this is set to True.How to add settings to the database?
More details on
django-admin galaxy-settings --help
Or via script/shell
Currently there is no API (WIP) so command and script is the only way to manage the settings.
Due to the validation, it is not recommended to write directly to the database.
How to read settings from database with current version of dynaconf?
How to read settings from db/cache after the upgrade to Dynaconf 3.2.2
1st enable
GALAXY_DYNAMIC_SETTINGS=True
via settings.py or PULP_ prefixed envvar.then access settings normally using django.
What about the API/UI?