Skip to content

Commit

Permalink
fixed settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Neagu committed Nov 5, 2024
1 parent 11164ac commit 09d4018
Showing 1 changed file with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import datetime

from pydantic import AliasChoices, Field, TypeAdapter, field_validator
from pydantic import AliasChoices, ConfigDict, Field, TypeAdapter, field_validator
from servicelib.logging_utils_filtering import LoggerName, MessageSubstring
from settings_library.application import BaseApplicationSettings
from settings_library.basic_types import LogLevel, VersionTag
Expand Down Expand Up @@ -32,19 +32,27 @@ class _BaseApplicationSettings(BaseApplicationSettings, MixinLoggingSettings):
DYNAMIC_SCHEDULER_LOG_FORMAT_LOCAL_DEV_ENABLED: bool = Field(
default=False,
validation_alias=AliasChoices(
"DYNAMIC_SCHEDULER_LOG_FORMAT_LOCAL_DEV_ENABLED",
"LOG_FORMAT_LOCAL_DEV_ENABLED",
"DYNAMIC_SCHEDULER_LOG_FORMAT_LOCAL_DEV_ENABLED",
),
description=(
"Enables local development log format. WARNING: make sure it "
"is disabled if you want to have structured logs!"
),
description="Enables local development log format. WARNING: make sure it is disabled if you want to have structured logs!",
)
DYNAMIC_SCHEDULER_LOG_FILTER_MAPPING: dict[
LoggerName, list[MessageSubstring]
] = Field(
default_factory=dict,
validation_alias=AliasChoices(
"DYNAMIC_SCHEDULER_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"
"LOG_FILTER_MAPPING",
"DYNAMIC_SCHEDULER_LOG_FILTER_MAPPING",
),
description=(
"is a dictionary that maps specific loggers "
"(such as 'uvicorn.access' or 'gunicorn.access') to a list "
"of log message patterns that should be filtered out."
),
description="is a dictionary that maps specific loggers (such as 'uvicorn.access' or 'gunicorn.access') to a list of log message patterns that should be filtered out.",
)

DYNAMIC_SCHEDULER_STOP_SERVICE_TIMEOUT: datetime.timedelta = Field(
Expand All @@ -60,6 +68,8 @@ class _BaseApplicationSettings(BaseApplicationSettings, MixinLoggingSettings):
def _validate_log_level(cls, value: str) -> str:
return cls.validate_log_level(value)

model_config = ConfigDict(extra="allow")


class ApplicationSettings(_BaseApplicationSettings):
"""Web app's environment variables
Expand Down

0 comments on commit 09d4018

Please sign in to comment.