Skip to content

Commit 303d0ca

Browse files
committed
s3 settings
1 parent 458b086 commit 303d0ca

File tree

2 files changed

+26
-17
lines changed

2 files changed

+26
-17
lines changed
Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from enum import StrEnum
2+
from typing import Annotated
23

34
from pydantic import Field, NonNegativeInt
45

@@ -13,19 +14,25 @@ class S3Provider(StrEnum):
1314

1415

1516
class RCloneSettings(BaseCustomSettings):
16-
R_CLONE_S3: S3Settings = Field(json_schema_extra={"auto_default_from_env": True})
17+
R_CLONE_S3: Annotated[
18+
S3Settings, Field(json_schema_extra={"auto_default_from_env": True})
19+
]
1720
R_CLONE_PROVIDER: S3Provider
1821

19-
# SEE https://rclone.org/docs/#transfers-n
20-
R_CLONE_OPTION_TRANSFERS: NonNegativeInt = Field(
21-
default=5, description="`--transfers X`: sets the amount of parallel transfers"
22-
)
23-
# SEE https://rclone.org/docs/#retries-int
24-
R_CLONE_OPTION_RETRIES: NonNegativeInt = Field(
25-
default=3, description="`--retries X`: times to retry each individual transfer"
26-
)
27-
# SEE https://rclone.org/docs/#buffer-size-size
28-
R_CLONE_OPTION_BUFFER_SIZE: str = Field(
29-
default="16M",
30-
description="`--buffer-size X`: sets the amount of RAM to use for each individual transfer",
31-
)
22+
R_CLONE_OPTION_TRANSFERS: Annotated[
23+
# SEE https://rclone.org/docs/#transfers-n
24+
NonNegativeInt,
25+
Field(description="`--transfers X`: sets the amount of parallel transfers"),
26+
] = 5
27+
R_CLONE_OPTION_RETRIES: Annotated[
28+
# SEE https://rclone.org/docs/#retries-int
29+
NonNegativeInt,
30+
Field(description="`--retries X`: times to retry each individual transfer"),
31+
] = 3
32+
R_CLONE_OPTION_BUFFER_SIZE: Annotated[
33+
# SEE https://rclone.org/docs/#buffer-size-size
34+
str,
35+
Field(
36+
description="`--buffer-size X`: sets the amount of RAM to use for each individual transfer",
37+
),
38+
] = "16M"

packages/settings-library/src/settings_library/s3.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import Annotated
2+
13
from pydantic import AnyHttpUrl, Field
24
from pydantic_settings import SettingsConfigDict
35

@@ -8,9 +10,9 @@
810
class S3Settings(BaseCustomSettings):
911
S3_ACCESS_KEY: IDStr
1012
S3_BUCKET_NAME: IDStr
11-
S3_ENDPOINT: AnyHttpUrl | None = Field(
12-
default=None, description="do not define if using standard AWS"
13-
)
13+
S3_ENDPOINT: Annotated[
14+
AnyHttpUrl | None, Field(description="do not define if using standard AWS")
15+
] = None
1416
S3_REGION: IDStr
1517
S3_SECRET_KEY: IDStr
1618

0 commit comments

Comments
 (0)