Last active
July 19, 2023 19:32
-
-
Save froi/c6fdb815e847af84a69072f6dd0078d1 to your computer and use it in GitHub Desktop.
pydantic-settings
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
from pydantic import BaseSettings | |
class Settings(BaseSettings): | |
"""Setting / configuration class that inherits from Pydantic BaseSettings | |
This will first check for environment variables of the same name, if none are found | |
the default values are applied. | |
More info: https://pydantic-docs.helpmanual.io/usage/settings/ | |
""" | |
# developer / debugging extras. Should not be enabled in production. | |
# If set, additional debugging features are enabled, and the log configuration is changed | |
# to send production-style logs to a file, while presenting "fancy" output and exception | |
# formatting on the console/stdout | |
development: bool = False | |
log_level: str = "DEBUG" | |
# developer local logging config - these settings only take effect if development mode is set | |
# Use fancy console output and exception info | |
devlog_console_rich: bool = True | |
# use colour | |
devlog_console_colour: bool = True | |
# if set, also log production-style JSON logs to the specified file | |
devlog_json_file: Optional[str] = "dev-log.json" | |
# pretty-format the file log JSON; compact if not set | |
devlog_json_pretty: bool = True | |
# SQLAlchemy's engine logger - when set to debug, will log columns for every query and | |
# every row returned. Very verbose. Default to INFO. | |
log_level_sqlalchemy_engine: str = "INFO" | |
# DB | |
sqlalchemy_database_uri: str = "" | |
settings = Settings() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment