Skip to content
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

DM-38339: Update to latest Safir, use Settings for config #213

Merged
merged 7 commits into from
Mar 16, 2023
Merged

Conversation

rra
Copy link
Member

@rra rra commented Mar 16, 2023

  • Use current_datetime and format_datetime_for_logging from Safir
  • Convert the configuration class to Settings and do more validation of input
  • Update the logging configuration to use enums and also configure Uvicorn logging
  • Use spawn_uvicorn to start a process for monkeyflocker testing

rra added 7 commits March 16, 2023 13:15
Use current_datetime and format_datetime_for_logging rather than
rolling our own versions.
Use the Pydantic Settings class for configuration instead of a
dataclass with os.getenv initializers. Fix the typing of URLs to
validate syntax, which unfortunately requires allowing None for
the test suite and adding more verification elsewhere. Be a bit
more robust in URL construction to allow for trailing slashes in
the configured URLs.

Switching the type to HttpUrl requires doing some weird things to
override the defaults in fixtures, but this is apparently the
correct Pydantic way of doing it.
Use enums for the configure_logging call and hard-code the production
logging syntax. Also configure Uvicorn logging to match.
On second thought, re-add the logging profile configuration and
default to development. We'll change the default to production in
Phalanx. The development logger makes it easier to understand test
output.
When constructing the loc part of the error detail, use the enum
provided by Safir.
Don't turn Uvicorn logs to JSON if we're not using JSON for the
rest of our logs.
We have to spawn an external application for monkeyflocker testing.
Use Safir's spawn_uvicorn rather than rolling our own, and use the
factory approach so that we can get proper type checking and black
formatting of the app.
@rra rra enabled auto-merge March 16, 2023 21:31
@rra rra merged commit 5841933 into main Mar 16, 2023
@rra rra deleted the tickets/DM-38339 branch March 16, 2023 21:34
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.

1 participant