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
RFC: Allow dot traversing to access nested dictionaries #84
Labels
Comments
rochacbruno
changed the title
Allow dot traversing to access nested dictionaries
RFC: Allow dot traversing to access nested dictionaries
Sep 21, 2018
As dynaconf uses Box https://github.com/cdgriffith/Box this functionality is easy to implement, the major concern is about testing and performance |
jperras
added a commit
to jperras/dynaconf
that referenced
this issue
Oct 16, 2018
A simple memoized recursion has been added to `get()` if the key contains at least one dot. The caller can choose to opt-out of this behaviour by specifying the `dotted_lookup` argument: ```python settings('AUTH.USERNAME', dotted_lookup=False) ``` While the performance impact of this has not been quantified, the net impact in any real-world application should be minimal due to typical nesting levels, and the fact that we overwrite the memoized portion of the dotted-key lookup on each iteration. - Avoids regressions [✓] - Can be opted-out on a per-call basis [✓] - Minimal performance impact [✓] - Documented [✓] - Tested [✓] - Examples added [✓] Closes dynaconf#84
@rochacbruno, considering the given |
@allan-silva this feature has been implemented! If the base |
jperras
added a commit
to jperras/dynaconf
that referenced
this issue
Oct 22, 2018
A simple memoized recursion has been added to `get()` if the key contains at least one dot. The caller can choose to opt-out of this behaviour by specifying the `dotted_lookup` argument: ```python settings('AUTH.USERNAME', dotted_lookup=False) ``` While the performance impact of this has not been quantified, the net impact in any real-world application should be minimal due to typical nesting levels, and the fact that we overwrite the memoized portion of the dotted-key lookup on each iteration. - Avoids regressions [✓] - Can be opted-out on a per-call basis [✓] - Minimal performance impact [✓] - Documented [✓] - Tested [✓] - Examples added [✓] Closes dynaconf#84
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lets take a
settings.yaml
To access the
port
you need to use one of:But what if you are not sure that the
REDIS
value is defined insettings.yaml
and you don't wanna fail?one way is relying on the
.get
default argument (dict like)RFC: Allow traversing
The
.
should be parsed onLazySettings.get
method and then perform the traversing.Requirements
opt-out
The text was updated successfully, but these errors were encountered: