-
-
Save francbartoli/d5eb24185c65d36c0580a7193d0e3c17 to your computer and use it in GitHub Desktop.
[App Settings] app settings using pydantic #fastapi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppSettings(BaseSettings): | |
project_name: Optional[str] | |
debug: bool = False | |
include_admin_routes: bool = False | |
# Server | |
server_name: Optional[str] | |
server_host: Optional[str] | |
sentry_dsn: Optional[str] | |
backend_cors_origins_str: str = "" # Should be a comma-separated list of origins | |
secret_key: bytes = os.urandom(32) | |
# URLs | |
api_v1_str: str = "/api/v1" | |
openapi_url: str = "/api/v1/openapi.json" | |
# Database | |
postgres_server: Optional[str] | |
postgres_user: Optional[str] | |
postgres_password: Optional[str] | |
postgres_db: Optional[str] | |
... | |
class Config: | |
env_prefix = "" # defaults to 'APP_' | |
settings = AppSettings() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment