Skip to content

Conversation

@tomgrin10
Copy link

@tomgrin10 tomgrin10 commented Nov 29, 2020

Change Summary

Added env_has_priority config option to BaseSettings class.
When set to True, the class will prioritize environment variables and secrets instead of constructor arguments.

Related issue number

Fixes pydantic/pydantic-settings#32

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes where applicable
  • changes/<pull request or issue id>-<github username>.md file added describing change
    (see changes/README.md for details)

@codecov
Copy link

codecov bot commented Nov 29, 2020

Codecov Report

Merging #2154 (ff9ecf2) into master (7c3919c) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master     pydantic/pydantic#2154   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        21           
  Lines         4103      4106    +3     
  Branches       824       825    +1     
=========================================
+ Hits          4103      4106    +3     
Impacted Files Coverage Δ
pydantic/env_settings.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7c3919c...ff9ecf2. Read the comment docs.

@samuelcolvin
Copy link
Member

see #2107, I think that PR and this one are incompatible.

It seems like people want even more potential sources of settings. With that a simple config flag to switch the order of two of settings sources is not flexible enough.

I'd rather improve #2107 to make it as easy to use as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BaseSettings: Customization of field value priority via Config

2 participants