fix: use .env files and ignore extra for settings subgroups
This commit is contained in:
parent
892ca515bb
commit
365444f907
@ -5,7 +5,12 @@ from pydantic_settings import BaseSettings, SettingsConfigDict
|
|||||||
|
|
||||||
|
|
||||||
class DatabaseSettings(BaseSettings):
|
class DatabaseSettings(BaseSettings):
|
||||||
model_config = SettingsConfigDict(env_prefix="DB_")
|
model_config = SettingsConfigDict(
|
||||||
|
env_prefix="DB_",
|
||||||
|
env_file=".env",
|
||||||
|
env_file_encoding="utf-8",
|
||||||
|
extra="ignore",
|
||||||
|
)
|
||||||
|
|
||||||
url: str = Field(
|
url: str = Field(
|
||||||
description="PostgreSQL connection string with asyncpg driver",
|
description="PostgreSQL connection string with asyncpg driver",
|
||||||
@ -25,7 +30,12 @@ class DatabaseSettings(BaseSettings):
|
|||||||
|
|
||||||
|
|
||||||
class RedisSettings(BaseSettings):
|
class RedisSettings(BaseSettings):
|
||||||
model_config = SettingsConfigDict(env_prefix="REDIS_")
|
model_config = SettingsConfigDict(
|
||||||
|
env_prefix="REDIS_",
|
||||||
|
env_file=".env",
|
||||||
|
env_file_encoding="utf-8",
|
||||||
|
extra="ignore",
|
||||||
|
)
|
||||||
|
|
||||||
url: str = Field(
|
url: str = Field(
|
||||||
default="redis://localhost:6379",
|
default="redis://localhost:6379",
|
||||||
@ -38,7 +48,12 @@ class RedisSettings(BaseSettings):
|
|||||||
|
|
||||||
|
|
||||||
class ProxyPipelineSettings(BaseSettings):
|
class ProxyPipelineSettings(BaseSettings):
|
||||||
model_config = SettingsConfigDict(env_prefix="PROXY_")
|
model_config = SettingsConfigDict(
|
||||||
|
env_prefix="PROXY_",
|
||||||
|
env_file=".env",
|
||||||
|
env_file_encoding="utf-8",
|
||||||
|
extra="ignore",
|
||||||
|
)
|
||||||
|
|
||||||
scrape_timeout_seconds: float = Field(
|
scrape_timeout_seconds: float = Field(
|
||||||
default=30.0,
|
default=30.0,
|
||||||
@ -74,7 +89,12 @@ class ProxyPipelineSettings(BaseSettings):
|
|||||||
|
|
||||||
|
|
||||||
class AccountSettings(BaseSettings):
|
class AccountSettings(BaseSettings):
|
||||||
model_config = SettingsConfigDict(env_prefix="ACCOUNT_")
|
model_config = SettingsConfigDict(
|
||||||
|
env_prefix="ACCOUNT_",
|
||||||
|
env_file=".env",
|
||||||
|
env_file_encoding="utf-8",
|
||||||
|
extra="ignore",
|
||||||
|
)
|
||||||
|
|
||||||
default_credits: int = Field(
|
default_credits: int = Field(
|
||||||
default=100,
|
default=100,
|
||||||
@ -92,7 +112,12 @@ class AccountSettings(BaseSettings):
|
|||||||
|
|
||||||
|
|
||||||
class NotificationSettings(BaseSettings):
|
class NotificationSettings(BaseSettings):
|
||||||
model_config = SettingsConfigDict(env_prefix="NOTIFY_")
|
model_config = SettingsConfigDict(
|
||||||
|
env_prefix="NOTIFY_",
|
||||||
|
env_file=".env",
|
||||||
|
env_file_encoding="utf-8",
|
||||||
|
extra="ignore",
|
||||||
|
)
|
||||||
|
|
||||||
smtp_host: str | None = Field(default=None)
|
smtp_host: str | None = Field(default=None)
|
||||||
smtp_port: int = Field(default=587)
|
smtp_port: int = Field(default=587)
|
||||||
@ -103,7 +128,12 @@ class NotificationSettings(BaseSettings):
|
|||||||
|
|
||||||
|
|
||||||
class CleanupSettings(BaseSettings):
|
class CleanupSettings(BaseSettings):
|
||||||
model_config = SettingsConfigDict(env_prefix="CLEANUP_")
|
model_config = SettingsConfigDict(
|
||||||
|
env_prefix="CLEANUP_",
|
||||||
|
env_file=".env",
|
||||||
|
env_file_encoding="utf-8",
|
||||||
|
extra="ignore",
|
||||||
|
)
|
||||||
|
|
||||||
prune_dead_after_days: int = Field(default=30)
|
prune_dead_after_days: int = Field(default=30)
|
||||||
prune_checks_after_days: int = Field(default=7)
|
prune_checks_after_days: int = Field(default=7)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user