Skip to content

Commit 32f043a

Browse files
committed
bump
1 parent 709f4ac commit 32f043a

File tree

1 file changed

+14
-11
lines changed
  • services/datcore-adapter/src/simcore_service_datcore_adapter/core

1 file changed

+14
-11
lines changed

services/datcore-adapter/src/simcore_service_datcore_adapter/core/settings.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from functools import cached_property
22

33
from models_library.basic_types import BootModeEnum, LogLevel
4-
from pydantic import Field, parse_obj_as, validator
4+
from pydantic import AliasChoices, Field, field_validator, parse_obj_as
55
from pydantic.networks import AnyUrl
66
from settings_library.base import BaseCustomSettings
77
from settings_library.tracing import TracingSettings
@@ -21,28 +21,31 @@ class ApplicationSettings(BaseCustomSettings, MixinLoggingSettings):
2121
SC_BOOT_MODE: BootModeEnum | None
2222

2323
LOG_LEVEL: LogLevel = Field(
24-
LogLevel.INFO.value,
25-
env=[
24+
default=LogLevel.INFO.value,
25+
validation_alias=AliasChoices(
2626
"DATCORE_ADAPTER_LOGLEVEL",
2727
"DATCORE_ADAPTER_LOG_LEVEL",
2828
"LOG_LEVEL",
2929
"LOGLEVEL",
30-
],
30+
),
3131
)
3232

33-
PENNSIEVE: PennsieveSettings = Field(auto_default_from_env=True)
33+
PENNSIEVE: PennsieveSettings = Field(
34+
json_schema_extra={"auto_default_from_env": True}
35+
)
3436

3537
DATCORE_ADAPTER_LOG_FORMAT_LOCAL_DEV_ENABLED: bool = Field(
36-
False,
37-
env=[
38+
default=False,
39+
validation_alias=AliasChoices(
3840
"DATCORE_ADAPTER_LOG_FORMAT_LOCAL_DEV_ENABLED",
3941
"LOG_FORMAT_LOCAL_DEV_ENABLED",
40-
],
42+
),
4143
description="Enables local development log format. WARNING: make sure it is disabled if you want to have structured logs!",
4244
)
4345
DATCORE_ADAPTER_PROMETHEUS_INSTRUMENTATION_ENABLED: bool = True
4446
DATCORE_ADAPTER_TRACING: TracingSettings | None = Field(
45-
auto_default_from_env=True, description="settings for opentelemetry tracing"
47+
description="settings for opentelemetry tracing",
48+
json_schema_extra={"auto_default_from_env": True},
4649
)
4750

4851
@cached_property
@@ -54,7 +57,7 @@ def debug(self) -> bool:
5457
BootModeEnum.LOCAL,
5558
]
5659

57-
@validator("LOG_LEVEL", pre=True)
60+
@field_validator("LOG_LEVEL", mode="before")
5861
@classmethod
59-
def _validate_loglevel(cls, value) -> str:
62+
def _validate_loglevel(cls, value: str) -> str:
6063
return cls.validate_log_level(value)

0 commit comments

Comments
 (0)