Skip to content

Conversation

@jsstevenson
Copy link
Member

@jsstevenson jsstevenson commented Sep 5, 2025

Close #106

  • Use pydantic-settings for configuration. This incorporates .env support, and validates configurations as they come in. I was previously unsure about this approach, but we basically use pydantic in every single package we make so I think it's fine.
  • Provide both the config class itself (which recomputes the configuration each time -- could be costly/dangerous or desirable, depending on context) and a get_config() function which caches its first result.
  • Importantly, doesn't calculate configs at all until the first time they're called, instead of doing so at import time
  • Plug configs into both CLI logging and FastAPI app logging settings
  • Also update the /service-info builtin test to use the new method we implemented in AnyVar (test against the openapi.yaml file rather than checking each value individually)

@jsstevenson jsstevenson added the priority:low Low priority label Sep 5, 2025
@jsstevenson jsstevenson changed the title feat: use pydantic-settings for config feat: use pydantic-settings for config and update FastAPI stuff Sep 5, 2025
jsstevenson added a commit to cancervariants/metakb that referenced this pull request Sep 9, 2025
close #538 

Reflects GenomicMedLab/software-templates#120.
Implement a centralized module for setting configurations, loads from
.env if available.

Use new `debug` option to set log level (INFO if unset, DEBUG if set).
We could also rename this or use a different variable to configure it if
we wanted more granular control but these two options seem fine for now
imo.

`test` config option isn't used for anything yet. In other cases, we've
used it to control whether or not "mock" or "fake" implementations of
things like DBs should be injected, or if live services should be used.
We haven't done this work yet, but I hope to soon.
@jsstevenson jsstevenson merged commit 9d986e1 into main Sep 9, 2025
3 checks passed
@jsstevenson jsstevenson deleted the new-config branch September 9, 2025 18:02
hmcostello pushed a commit to cancervariants/metakb that referenced this pull request Oct 17, 2025
close #538 

Reflects GenomicMedLab/software-templates#120.
Implement a centralized module for setting configurations, loads from
.env if available.

Use new `debug` option to set log level (INFO if unset, DEBUG if set).
We could also rename this or use a different variable to configure it if
we wanted more granular control but these two options seem fine for now
imo.

`test` config option isn't used for anything yet. In other cases, we've
used it to control whether or not "mock" or "fake" implementations of
things like DBs should be injected, or if live services should be used.
We haven't done this work yet, but I hope to soon.
korikuzma pushed a commit to cancervariants/metakb that referenced this pull request Oct 30, 2025
close #538 

Reflects GenomicMedLab/software-templates#120.
Implement a centralized module for setting configurations, loads from
.env if available.

Use new `debug` option to set log level (INFO if unset, DEBUG if set).
We could also rename this or use a different variable to configure it if
we wanted more granular control but these two options seem fine for now
imo.

`test` config option isn't used for anything yet. In other cases, we've
used it to control whether or not "mock" or "fake" implementations of
things like DBs should be injected, or if live services should be used.
We haven't done this work yet, but I hope to soon.
korikuzma pushed a commit to cancervariants/metakb that referenced this pull request Nov 19, 2025
close #538 

Reflects GenomicMedLab/software-templates#120.
Implement a centralized module for setting configurations, loads from
.env if available.

Use new `debug` option to set log level (INFO if unset, DEBUG if set).
We could also rename this or use a different variable to configure it if
we wanted more granular control but these two options seem fine for now
imo.

`test` config option isn't used for anything yet. In other cases, we've
used it to control whether or not "mock" or "fake" implementations of
things like DBs should be injected, or if live services should be used.
We haven't done this work yet, but I hope to soon.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:low Low priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update app configuration

3 participants