Skip to content
This repository has been archived by the owner on Dec 24, 2024. It is now read-only.

Commit

Permalink
chore: handle environment variables for configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
1995parham committed Mar 9, 2024
1 parent 97d62ed commit b23d45d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ class HTTP(pydantic.BaseModel):

class Settings(pydantic_settings.BaseSettings):
"""
Configuration holder
Configuration holder which reads configuration from config.toml
and environment variables.
"""

http: HTTP = HTTP(debug=True)
model_config = pydantic_settings.SettingsConfigDict(toml_file="config.toml")
model_config = pydantic_settings.SettingsConfigDict(
toml_file="config.toml",
env_prefix="fastapi101_",
case_sensitive=False,
env_nested_delimiter="__",
)

@classmethod
def settings_customise_sources(
Expand Down

0 comments on commit b23d45d

Please sign in to comment.