This repository has been archived by the owner on Nov 30, 2022. It is now read-only.
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.
Improve configuration variable troubleshooting with DEBUG logs, more helpful errors, and unit tests #579
Improve configuration variable troubleshooting with DEBUG logs, more helpful errors, and unit tests #579
Changes from all commits
b8fa0d8
6f1c970
153d4f0
3274a22
1721fd2
755154c
89b7fb8
da8ada6
3233775
3aba69d
299442b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This gets called during
start_webserver
to provide some helpful DEBUG logs. I find it's often difficult to figure out if my ENV variables or configuration file is loading as expected, so this aids in thatThere 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.
this will be super helpful, thanks!
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.
Catching the
ValidationError
here was odd; it basically made it try loading the config twice:This is surprising, because if you have an invalid config it fails twice, and usually with different error messages, which is misleading.
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.
By removing this catch, the validation error simply crashes startup and throws a more relevant warning log and stacktrace.
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.
good catch, I'll actually have to update this on my fideslog integration branch
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.
Ideally let's get this merged to
main
so you can just rebase 👍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 increasingly of the opinion we should remove the
LOG_PII
variable, and just use this singleLOG_LEVEL
instead. Having DEBUG vs INFO logs is a standard config option most apps support, so it'll be more intuitive to use this.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.
NOTE: I really wanted to DEBUG log all the
ENV
vars at startup too, but by the time this method runs theFidesopsConfig
has already been loaded (and potentially crashed), so it's too late. Since we're using the config to set the log level simultaneously, it's awkward to use DEBUG logs to see theENV
vars... kind of a chicken & egg situation.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.
These first three tests (load from default, load from path, load from ENV) didn't have any tests yet so I added some basic ones