File tree Expand file tree Collapse file tree 3 files changed +17
-8
lines changed
packages/settings-library Expand file tree Collapse file tree 3 files changed +17
-8
lines changed Original file line number Diff line number Diff line change 1313
1414# installs this repo's packages
1515--editable ../pytest-simcore/
16+ --editable ../models-library
1617
1718# current module
1819--editable .
Original file line number Diff line number Diff line change 1- from pydantic import AnyHttpUrl , Field
1+ from typing import Annotated
2+
3+ from pydantic import AnyHttpUrl , BeforeValidator , Field , TypeAdapter
24from pydantic_settings import SettingsConfigDict
35
46from .base import BaseCustomSettings
57
8+ ANY_HTTP_URL_ADAPTER : TypeAdapter = TypeAdapter (AnyHttpUrl )
9+
610
711class EC2Settings (BaseCustomSettings ):
812 EC2_ACCESS_KEY_ID : str
9- EC2_ENDPOINT : AnyHttpUrl | None = Field (
10- default = None , description = "do not define if using standard AWS"
11- )
13+ EC2_ENDPOINT : Annotated [
14+ str , BeforeValidator ( lambda x : str ( ANY_HTTP_URL_ADAPTER . validate_python ( x )))
15+ ] | None = Field ( default = None , description = "do not define if using standard AWS" )
1216 EC2_REGION_NAME : str = "us-east-1"
1317 EC2_SECRET_ACCESS_KEY : str
1418
Original file line number Diff line number Diff line change 1- from pydantic import AnyHttpUrl , Field
1+ from typing import Annotated
2+
3+ from pydantic import AnyHttpUrl , BeforeValidator , Field , TypeAdapter
24from pydantic_settings import SettingsConfigDict
35
46from .base import BaseCustomSettings
57from .basic_types import IDStr
68
9+ ANY_HTTP_URL_ADAPTER : TypeAdapter = TypeAdapter (AnyHttpUrl )
10+
711
812class S3Settings (BaseCustomSettings ):
913 S3_ACCESS_KEY : IDStr
1014 S3_BUCKET_NAME : IDStr
11- S3_ENDPOINT : AnyHttpUrl | None = Field (
12- default = None , description = "do not define if using standard AWS"
13- )
15+ S3_ENDPOINT : Annotated [
16+ str , BeforeValidator ( lambda x : str ( ANY_HTTP_URL_ADAPTER . validate_python ( x )))
17+ ] | None = Field ( default = None , description = "do not define if using standard AWS" )
1418 S3_REGION : IDStr
1519 S3_SECRET_KEY : IDStr
1620
You can’t perform that action at this time.
0 commit comments