-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
48 lines (35 loc) · 1.33 KB
/
Copy pathconfig.py
File metadata and controls
48 lines (35 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""Main configuration file for the API."""
from zoneinfo import ZoneInfo
from pydantic import SecretStr
from pydantic_extra_types.coordinate import Coordinate, Latitude, Longitude
from pydantic_settings import BaseSettings, SettingsConfigDict
class WeatherSettings(BaseSettings):
"""Weather-related settings."""
LOCATION: Coordinate = Coordinate(Latitude(29.8469), Longitude(-95.4689))
WEATHER_API_BASE: str = "https://api.weather.gov"
WEATHER_HEADERS: dict = {"User-Agent": "(milsman2, milsman2@gmail.com)"}
model_config = SettingsConfigDict(
env_file=".env",
env_file_encoding="utf-8",
case_sensitive=False,
)
class Settings(BaseSettings):
"""Application settings display."""
TEST_MODE: bool = False
APP_NAME: str = "python-app-template"
DATE_FORMAT: str = "%Y-%m-%d %I:%M:%S %p %Z"
TIMEZONE: str = "America/Chicago"
PROMETHEUS_METRICS_PORT: int = 8000
GF_SECURITY_ADMIN_PASSWORD: SecretStr = SecretStr("admin")
LOG_LEVEL: str = "INFO"
model_config = SettingsConfigDict(
env_file=".env",
env_file_encoding="utf-8",
case_sensitive=False,
)
@property
def tz(self) -> ZoneInfo:
"""Return the configured timezone info."""
return ZoneInfo(self.TIMEZONE)
settings = Settings()
weather_settings = WeatherSettings()