Skip to content

Commit 98fc535

Browse files
fix code
1 parent 4a435d1 commit 98fc535

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

services/efs-guardian/src/simcore_service_efs_guardian/core/application.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121

2222
def create_app(settings: ApplicationSettings) -> FastAPI:
23-
logger.info("app settings: %s", settings.json(indent=1))
23+
logger.info("app settings: %s", settings.model_dump_json(indent=1))
2424

2525
app = FastAPI(
2626
debug=settings.EFS_GUARDIAN_DEBUG,

services/efs-guardian/src/simcore_service_efs_guardian/core/settings.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
LogLevel,
99
VersionTag,
1010
)
11-
from pydantic import Field, PositiveInt, validator
11+
from pydantic import AliasChoices, Field, PositiveInt, field_validator
1212
from settings_library.base import BaseCustomSettings
1313
from settings_library.efs import AwsEfsSettings
1414
from settings_library.rabbit import RabbitSettings
@@ -59,28 +59,35 @@ class ApplicationSettings(BaseCustomSettings, MixinLoggingSettings):
5959

6060
# RUNTIME -----------------------------------------------------------
6161
EFS_GUARDIAN_DEBUG: bool = Field(
62-
default=False, description="Debug mode", env=["EFS_GUARDIAN_DEBUG", "DEBUG"]
62+
default=False,
63+
description="Debug mode",
64+
validation_alias=AliasChoices("EFS_GUARDIAN_DEBUG", "DEBUG"),
6365
)
6466
EFS_GUARDIAN_LOGLEVEL: LogLevel = Field(
65-
LogLevel.INFO, env=["EFS_GUARDIAN_LOGLEVEL", "LOG_LEVEL", "LOGLEVEL"]
67+
LogLevel.INFO,
68+
validation_alias=AliasChoices("EFS_GUARDIAN_LOGLEVEL", "LOG_LEVEL", "LOGLEVEL"),
6669
)
6770
EFS_GUARDIAN_LOG_FORMAT_LOCAL_DEV_ENABLED: bool = Field(
6871
default=False,
69-
env=[
72+
validation_alias=AliasChoices(
7073
"EFS_GUARDIAN_LOG_FORMAT_LOCAL_DEV_ENABLED",
7174
"LOG_FORMAT_LOCAL_DEV_ENABLED",
72-
],
75+
),
7376
description="Enables local development log format. WARNING: make sure it is disabled if you want to have structured logs!",
7477
)
7578

76-
EFS_GUARDIAN_AWS_EFS_SETTINGS: AwsEfsSettings = Field(auto_default_from_env=True)
77-
EFS_GUARDIAN_RABBITMQ: RabbitSettings = Field(auto_default_from_env=True)
79+
EFS_GUARDIAN_AWS_EFS_SETTINGS: AwsEfsSettings = Field(
80+
json_schema_extra={"auto_default_from_env": True}
81+
)
82+
EFS_GUARDIAN_RABBITMQ: RabbitSettings = Field(
83+
json_schema_extra={"auto_default_from_env": True}
84+
)
7885

7986
@cached_property
8087
def LOG_LEVEL(self) -> LogLevel: # noqa: N802
8188
return self.EFS_GUARDIAN_LOGLEVEL
8289

83-
@validator("EFS_GUARDIAN_LOGLEVEL")
90+
@field_validator("EFS_GUARDIAN_LOGLEVEL")
8491
@classmethod
8592
def valid_log_level(cls, value: str) -> str:
8693
return cls.validate_log_level(value)

services/efs-guardian/src/simcore_service_efs_guardian/exceptions/_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Any
22

3-
from models_library.errors_classes import OsparcErrorMixin
3+
from common_library.errors_classes import OsparcErrorMixin
44

55

66
class EfsGuardianBaseError(OsparcErrorMixin, Exception):

0 commit comments

Comments
 (0)