Skip to content

Commit f168a83

Browse files
committed
cleanup catalo gsettings
1 parent 0394889 commit f168a83

File tree

1 file changed

+49
-34
lines changed
  • services/catalog/src/simcore_service_catalog/core

1 file changed

+49
-34
lines changed

services/catalog/src/simcore_service_catalog/core/settings.py

Lines changed: 49 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from functools import cached_property
33
from typing import Annotated, Final
44

5+
from common_library.basic_types import DEFAULT_FACTORY
56
from models_library.api_schemas_catalog.services_specifications import (
67
ServiceSpecifications,
78
)
@@ -59,40 +60,51 @@ class ApplicationSettings(BaseApplicationSettings, MixinLoggingSettings):
5960
),
6061
),
6162
] = LogLevel.INFO
62-
CATALOG_LOG_FORMAT_LOCAL_DEV_ENABLED: bool = Field(
63-
default=False,
64-
validation_alias=AliasChoices(
65-
"CATALOG_LOG_FORMAT_LOCAL_DEV_ENABLED", "LOG_FORMAT_LOCAL_DEV_ENABLED"
63+
CATALOG_LOG_FORMAT_LOCAL_DEV_ENABLED: Annotated[
64+
bool,
65+
Field(
66+
validation_alias=AliasChoices(
67+
"CATALOG_LOG_FORMAT_LOCAL_DEV_ENABLED", "LOG_FORMAT_LOCAL_DEV_ENABLED"
68+
),
69+
description="Enables local development log format. WARNING: make sure it is disabled if you want to have structured logs!",
6670
),
67-
description="Enables local development log format. WARNING: make sure it is disabled if you want to have structured logs!",
68-
)
69-
CATALOG_LOG_FILTER_MAPPING: dict[LoggerName, list[MessageSubstring]] = Field(
70-
default_factory=dict,
71-
validation_alias=AliasChoices(
72-
"CATALOG_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"
71+
] = False
72+
CATALOG_LOG_FILTER_MAPPING: Annotated[
73+
dict[LoggerName, list[MessageSubstring]],
74+
Field(
75+
default_factory=dict,
76+
validation_alias=AliasChoices(
77+
"CATALOG_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"
78+
),
79+
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.",
7380
),
74-
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.",
75-
)
76-
CATALOG_DEV_FEATURES_ENABLED: bool = Field(
77-
default=False,
78-
description="Enables development features. WARNING: make sure it is disabled in production .env file!",
79-
)
81+
] = DEFAULT_FACTORY
8082

81-
CATALOG_POSTGRES: PostgresSettings | None = Field(
82-
json_schema_extra={"auto_default_from_env": True}
83-
)
83+
CATALOG_DEV_FEATURES_ENABLED: Annotated[
84+
bool,
85+
Field(
86+
description="Enables development features. WARNING: make sure it is disabled in production .env file!",
87+
),
88+
] = False
8489

85-
CATALOG_RABBITMQ: RabbitSettings = Field(
86-
json_schema_extra={"auto_default_from_env": True}
87-
)
90+
CATALOG_POSTGRES: Annotated[
91+
PostgresSettings | None,
92+
Field(json_schema_extra={"auto_default_from_env": True}),
93+
]
8894

89-
CATALOG_CLIENT_REQUEST: ClientRequestSettings | None = Field(
90-
json_schema_extra={"auto_default_from_env": True}
91-
)
95+
CATALOG_RABBITMQ: Annotated[
96+
RabbitSettings, Field(json_schema_extra={"auto_default_from_env": True})
97+
]
9298

93-
CATALOG_DIRECTOR: DirectorSettings | None = Field(
94-
json_schema_extra={"auto_default_from_env": True}
95-
)
99+
CATALOG_CLIENT_REQUEST: Annotated[
100+
ClientRequestSettings | None,
101+
Field(json_schema_extra={"auto_default_from_env": True}),
102+
]
103+
104+
CATALOG_DIRECTOR: Annotated[
105+
DirectorSettings | None,
106+
Field(json_schema_extra={"auto_default_from_env": True}),
107+
]
96108

97109
CATALOG_PROMETHEUS_INSTRUMENTATION_ENABLED: bool = True
98110

@@ -106,10 +118,13 @@ class ApplicationSettings(BaseApplicationSettings, MixinLoggingSettings):
106118
CATALOG_SERVICES_DEFAULT_SPECIFICATIONS: ServiceSpecifications = (
107119
_DEFAULT_SERVICE_SPECIFICATIONS
108120
)
109-
CATALOG_TRACING: TracingSettings | None = Field(
110-
json_schema_extra={"auto_default_from_env": True},
111-
description="settings for opentelemetry tracing",
112-
)
121+
CATALOG_TRACING: Annotated[
122+
TracingSettings | None,
123+
Field(
124+
json_schema_extra={"auto_default_from_env": True},
125+
description="settings for opentelemetry tracing",
126+
),
127+
]
113128

114-
DIRECTOR_DEFAULT_MAX_MEMORY: NonNegativeInt = Field(default=0)
115-
DIRECTOR_DEFAULT_MAX_NANO_CPUS: NonNegativeInt = Field(default=0)
129+
DIRECTOR_DEFAULT_MAX_MEMORY: NonNegativeInt = 0
130+
DIRECTOR_DEFAULT_MAX_NANO_CPUS: NonNegativeInt = 0

0 commit comments

Comments
 (0)