putfs 0.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- putfs-0.0.0/LICENSE +201 -0
- putfs-0.0.0/PKG-INFO +55 -0
- putfs-0.0.0/README.md +27 -0
- putfs-0.0.0/putfs/__init__.py +1 -0
- putfs-0.0.0/putfs/api.py +125 -0
- putfs-0.0.0/putfs/cli.py +7 -0
- putfs-0.0.0/putfs/client/__init__.py +3 -0
- putfs-0.0.0/putfs/client/cli.py +128 -0
- putfs-0.0.0/putfs/client/http.py +90 -0
- putfs-0.0.0/putfs/client/sync.py +80 -0
- putfs-0.0.0/putfs/fs.py +74 -0
- putfs-0.0.0/putfs/py.typed +0 -0
- putfs-0.0.0/putfs/s3/__init__.py +3 -0
- putfs-0.0.0/putfs/s3/api.py +280 -0
- putfs-0.0.0/putfs/s3/auth.py +109 -0
- putfs-0.0.0/putfs/settings.py +35 -0
- putfs-0.0.0/pyproject.toml +78 -0
putfs-0.0.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
putfs-0.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: putfs
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: Efficient HTTP blob storage over local filesystem
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Author: Simon Wörpel
|
|
8
|
+
Author-email: simon.woerpel@pm.me
|
|
9
|
+
Requires-Python: >=3.13,<4
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Provides-Extra: client
|
|
16
|
+
Provides-Extra: s3
|
|
17
|
+
Requires-Dist: anyio (>=4.13.0,<5.0.0)
|
|
18
|
+
Requires-Dist: anystore (>=1.1.7,<2.0.0) ; extra == "client"
|
|
19
|
+
Requires-Dist: awssig (>=0.5.0) ; extra == "s3"
|
|
20
|
+
Requires-Dist: granian (>=2.7.2,<3.0.0)
|
|
21
|
+
Requires-Dist: starlette (>=1.0.0,<2.0.0)
|
|
22
|
+
Requires-Dist: uvloop (>=0.22.1,<0.23.0)
|
|
23
|
+
Project-URL: Homepage, https://putf.sh
|
|
24
|
+
Project-URL: Issues, https://github.com/dataresearchcenter/putfs/issues
|
|
25
|
+
Project-URL: Repository, https://github.com/dataresearchcenter/putfs
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# PutFS
|
|
29
|
+
|
|
30
|
+
Just a `PUT` and `DELETE` API over a plain directory hierarchy with zero opinions.
|
|
31
|
+
|
|
32
|
+
Wired together with optimized Nginx and a well-tuned filesystem, these few lines of async Python [outperform MinIO](https://putf.sh/benchmarks/) and related systems at scale. And we didn't even port to Rust.
|
|
33
|
+
|
|
34
|
+
## Why?
|
|
35
|
+
|
|
36
|
+
MinIO became [AIStor](https://min.io). $96,000/year. [Ceph](https://ceph.io), [SeaweedFS](https://github.com/seaweedfs/seaweedfs), [Garage](https://garagehq.deuxfleurs.fr) – each solve a different problem than *"I have a server, I need to store files over HTTP."*
|
|
37
|
+
|
|
38
|
+
**PutFS** delegates everything to battle-tested tools: [nginx](https://nginx.org) for file serving and auth, [ZFS](https://openzfs.org) for erasure coding and caching, [zrepl](https://zrepl.github.io)/[rsync](https://rsync.samba.org) for replication. S3 compat layer included.
|
|
39
|
+
|
|
40
|
+
If **PutFS** disappears tomorrow, we can still `ls -la` your data.
|
|
41
|
+
|
|
42
|
+
## Docs
|
|
43
|
+
|
|
44
|
+
[**putf.sh**](https://putf.sh)
|
|
45
|
+
|
|
46
|
+
- [Quickstart](https://putf.sh/quickstart/)
|
|
47
|
+
- [MinIO migration](https://putf.sh/minio-migration/)
|
|
48
|
+
- [Benchmarks](https://putf.sh/benchmarks/)
|
|
49
|
+
- [Reference](https://putf.sh/reference/model/) – auth, replication, encryption, versioning, scaling, ...
|
|
50
|
+
- [Tuning](https://putf.sh/tuning/nginx/) – nginx, granian, ZFS
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
Apache 2.0. (well, reasons.)
|
|
55
|
+
|
putfs-0.0.0/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# PutFS
|
|
2
|
+
|
|
3
|
+
Just a `PUT` and `DELETE` API over a plain directory hierarchy with zero opinions.
|
|
4
|
+
|
|
5
|
+
Wired together with optimized Nginx and a well-tuned filesystem, these few lines of async Python [outperform MinIO](https://putf.sh/benchmarks/) and related systems at scale. And we didn't even port to Rust.
|
|
6
|
+
|
|
7
|
+
## Why?
|
|
8
|
+
|
|
9
|
+
MinIO became [AIStor](https://min.io). $96,000/year. [Ceph](https://ceph.io), [SeaweedFS](https://github.com/seaweedfs/seaweedfs), [Garage](https://garagehq.deuxfleurs.fr) – each solve a different problem than *"I have a server, I need to store files over HTTP."*
|
|
10
|
+
|
|
11
|
+
**PutFS** delegates everything to battle-tested tools: [nginx](https://nginx.org) for file serving and auth, [ZFS](https://openzfs.org) for erasure coding and caching, [zrepl](https://zrepl.github.io)/[rsync](https://rsync.samba.org) for replication. S3 compat layer included.
|
|
12
|
+
|
|
13
|
+
If **PutFS** disappears tomorrow, we can still `ls -la` your data.
|
|
14
|
+
|
|
15
|
+
## Docs
|
|
16
|
+
|
|
17
|
+
[**putf.sh**](https://putf.sh)
|
|
18
|
+
|
|
19
|
+
- [Quickstart](https://putf.sh/quickstart/)
|
|
20
|
+
- [MinIO migration](https://putf.sh/minio-migration/)
|
|
21
|
+
- [Benchmarks](https://putf.sh/benchmarks/)
|
|
22
|
+
- [Reference](https://putf.sh/reference/model/) – auth, replication, encryption, versioning, scaling, ...
|
|
23
|
+
- [Tuning](https://putf.sh/tuning/nginx/) – nginx, granian, ZFS
|
|
24
|
+
|
|
25
|
+
## License
|
|
26
|
+
|
|
27
|
+
Apache 2.0. (well, reasons.)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.0.0"
|
putfs-0.0.0/putfs/api.py
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import errno
|
|
2
|
+
import fnmatch
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
import anyio
|
|
6
|
+
from starlette.applications import Starlette
|
|
7
|
+
from starlette.requests import Request
|
|
8
|
+
from starlette.responses import Response, StreamingResponse
|
|
9
|
+
from starlette.routing import Route
|
|
10
|
+
|
|
11
|
+
from putfs.fs import format_mtime, iter_keys, safe_path
|
|
12
|
+
from putfs.settings import Settings
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def create_app() -> Starlette:
|
|
16
|
+
settings = Settings()
|
|
17
|
+
root = Path(settings.root).resolve()
|
|
18
|
+
chunk_size = settings.chunk_size
|
|
19
|
+
|
|
20
|
+
async def get(request: Request) -> Response:
|
|
21
|
+
key = request.path_params["key"]
|
|
22
|
+
exclude_prefix = request.query_params.get("exclude_prefix")
|
|
23
|
+
glob = request.query_params.get("glob")
|
|
24
|
+
depth_str = request.query_params.get("depth")
|
|
25
|
+
depth = int(depth_str) if depth_str else None
|
|
26
|
+
|
|
27
|
+
if key == "" or key.endswith("/"):
|
|
28
|
+
prefix = key.rstrip("/")
|
|
29
|
+
base = safe_path(root, prefix)
|
|
30
|
+
# qualify user-supplied filters to root-relative paths
|
|
31
|
+
abs_exclude = f"{prefix}/{exclude_prefix}" if exclude_prefix else None
|
|
32
|
+
abs_glob = f"{prefix}/{glob}" if glob else None
|
|
33
|
+
|
|
34
|
+
async def stream_keys():
|
|
35
|
+
async for k in iter_keys(root, base, abs_exclude, abs_glob, depth):
|
|
36
|
+
# return paths relative to the listed prefix
|
|
37
|
+
rel = k[len(prefix) + 1 :] if k.startswith(prefix + "/") else k
|
|
38
|
+
yield f"{rel}\n"
|
|
39
|
+
|
|
40
|
+
return StreamingResponse(
|
|
41
|
+
stream_keys(), media_type="application/octet-stream"
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
path = safe_path(root, key)
|
|
45
|
+
if not path.is_file():
|
|
46
|
+
return Response(status_code=404, content=key)
|
|
47
|
+
|
|
48
|
+
stat = path.stat()
|
|
49
|
+
headers = {
|
|
50
|
+
"content-length": str(stat.st_size),
|
|
51
|
+
"last-modified": format_mtime(stat.st_mtime),
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async def stream():
|
|
55
|
+
async with await anyio.open_file(path, "rb") as f:
|
|
56
|
+
while chunk := await f.read(chunk_size):
|
|
57
|
+
yield chunk
|
|
58
|
+
|
|
59
|
+
return StreamingResponse(stream(), headers=headers)
|
|
60
|
+
|
|
61
|
+
async def head(request: Request) -> Response:
|
|
62
|
+
key = request.path_params["key"]
|
|
63
|
+
path = safe_path(root, key)
|
|
64
|
+
if not path.is_file():
|
|
65
|
+
return Response(status_code=404)
|
|
66
|
+
stat = path.stat()
|
|
67
|
+
return Response(
|
|
68
|
+
status_code=200,
|
|
69
|
+
headers={
|
|
70
|
+
"content-length": str(stat.st_size),
|
|
71
|
+
"last-modified": format_mtime(stat.st_mtime),
|
|
72
|
+
},
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
async def put(request: Request) -> Response:
|
|
76
|
+
key = request.path_params["key"]
|
|
77
|
+
path = safe_path(root, key)
|
|
78
|
+
# return fast if worm
|
|
79
|
+
for glob in settings.worm_globs:
|
|
80
|
+
if fnmatch.fnmatch(key, glob):
|
|
81
|
+
if path.exists():
|
|
82
|
+
if settings.worm_strict:
|
|
83
|
+
return Response(status_code=403, content="Forbidden (WORM)")
|
|
84
|
+
return Response(status_code=204)
|
|
85
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
86
|
+
try:
|
|
87
|
+
async with await anyio.open_file(path, "wb") as f:
|
|
88
|
+
async for chunk in request.stream():
|
|
89
|
+
await f.write(chunk)
|
|
90
|
+
except OSError as e:
|
|
91
|
+
if e.errno == errno.ENOSPC:
|
|
92
|
+
return Response(status_code=507, content="Insufficient Storage")
|
|
93
|
+
if e.errno in (errno.EPERM, errno.EACCES, errno.EROFS):
|
|
94
|
+
return Response(status_code=403, content="Forbidden")
|
|
95
|
+
raise
|
|
96
|
+
return Response(status_code=204)
|
|
97
|
+
|
|
98
|
+
async def delete(request: Request) -> Response:
|
|
99
|
+
key = request.path_params["key"]
|
|
100
|
+
path = safe_path(root, key)
|
|
101
|
+
if not path.exists():
|
|
102
|
+
return Response(status_code=404)
|
|
103
|
+
if not settings.worm_allow_delete:
|
|
104
|
+
for glob in settings.worm_globs:
|
|
105
|
+
if fnmatch.fnmatch(key, glob):
|
|
106
|
+
return Response(status_code=403, content="Forbidden (WORM)")
|
|
107
|
+
try:
|
|
108
|
+
path.unlink()
|
|
109
|
+
except OSError as e:
|
|
110
|
+
if e.errno in (errno.EPERM, errno.EACCES, errno.EROFS):
|
|
111
|
+
return Response(status_code=403, content="Forbidden")
|
|
112
|
+
raise
|
|
113
|
+
return Response(status_code=204)
|
|
114
|
+
|
|
115
|
+
return Starlette(
|
|
116
|
+
routes=[
|
|
117
|
+
Route("/{key:path}", get, methods=["GET"]),
|
|
118
|
+
Route("/{key:path}", head, methods=["HEAD"]),
|
|
119
|
+
Route("/{key:path}", put, methods=["PUT"]),
|
|
120
|
+
Route("/{key:path}", delete, methods=["DELETE"]),
|
|
121
|
+
],
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
app = create_app()
|
putfs-0.0.0/putfs/cli.py
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
from typing import Annotated, Optional
|
|
2
|
+
|
|
3
|
+
from anystore.logic.io import stream
|
|
4
|
+
import typer
|
|
5
|
+
from rich import print
|
|
6
|
+
|
|
7
|
+
from putfs import __version__
|
|
8
|
+
from putfs.client.http import get_resource, get_store
|
|
9
|
+
from putfs.client.sync import sync
|
|
10
|
+
from putfs.settings import Settings
|
|
11
|
+
|
|
12
|
+
settings = Settings()
|
|
13
|
+
cli = typer.Typer(
|
|
14
|
+
no_args_is_help=True,
|
|
15
|
+
help=(
|
|
16
|
+
"PutFS CLI -- copy, sync, list, and delete objects on a PutFS server.\n\n"
|
|
17
|
+
"Authenticate via --key/--secret flags or PUTFS_API_KEY/PUTFS_API_SECRET env vars. "
|
|
18
|
+
"URIs use putfs://host:port/path for PutFS stores; "
|
|
19
|
+
"local paths and all anystore URIs (http(s)://, s3://, gs://, etc.) for others."
|
|
20
|
+
),
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
state: dict = {"key": settings.api_key, "secret": settings.api_secret}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@cli.callback(invoke_without_command=True)
|
|
27
|
+
def cli_main(
|
|
28
|
+
version: Annotated[
|
|
29
|
+
Optional[bool], typer.Option("--version", help="Show version")
|
|
30
|
+
] = False,
|
|
31
|
+
settings: Annotated[
|
|
32
|
+
Optional[bool], typer.Option("--settings", help="Show current settings")
|
|
33
|
+
] = False,
|
|
34
|
+
key: Annotated[
|
|
35
|
+
Optional[str], typer.Option("--key", help="API key")
|
|
36
|
+
] = settings.api_key,
|
|
37
|
+
secret: Annotated[
|
|
38
|
+
Optional[str], typer.Option("--secret", help="API secret")
|
|
39
|
+
] = settings.api_secret,
|
|
40
|
+
):
|
|
41
|
+
if version:
|
|
42
|
+
typer.echo(__version__)
|
|
43
|
+
raise typer.Exit()
|
|
44
|
+
if settings:
|
|
45
|
+
print(Settings().__dict__)
|
|
46
|
+
if key:
|
|
47
|
+
state["key"] = key
|
|
48
|
+
if secret:
|
|
49
|
+
state["secret"] = secret
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@cli.command("cp")
|
|
53
|
+
def cli_cp(src: str, dst: str):
|
|
54
|
+
"""Stream-Copy a single file between stores."""
|
|
55
|
+
src_res = get_resource(src, **state)
|
|
56
|
+
dst_res = get_resource(dst, **state)
|
|
57
|
+
with src_res.open(mode="rb") as i:
|
|
58
|
+
with dst_res.open(mode="wb") as o:
|
|
59
|
+
stream(i, o, settings.chunk_size)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@cli.command("ls")
|
|
63
|
+
def cli_ls(
|
|
64
|
+
uri: str,
|
|
65
|
+
glob: Annotated[Optional[str], typer.Option("--glob", help="Glob pattern")] = None,
|
|
66
|
+
exclude_prefix: Annotated[
|
|
67
|
+
Optional[str], typer.Option("--exclude-prefix", help="Exclude prefix")
|
|
68
|
+
] = None,
|
|
69
|
+
):
|
|
70
|
+
"""List keys in a store."""
|
|
71
|
+
store = get_store(uri, **state)
|
|
72
|
+
for key in store.iterate_keys(
|
|
73
|
+
exclude_prefix=exclude_prefix,
|
|
74
|
+
glob=glob,
|
|
75
|
+
):
|
|
76
|
+
typer.echo(key)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@cli.command("sync")
|
|
80
|
+
def cli_sync(
|
|
81
|
+
src: str,
|
|
82
|
+
dst: str,
|
|
83
|
+
delete: Annotated[
|
|
84
|
+
bool, typer.Option("--delete", help="Delete extra keys in target")
|
|
85
|
+
] = False,
|
|
86
|
+
overwrite: Annotated[
|
|
87
|
+
bool, typer.Option("--overwrite", help="Skip diff checks, upload everything")
|
|
88
|
+
] = False,
|
|
89
|
+
worm: Annotated[
|
|
90
|
+
bool, typer.Option("--worm", help="WORM mode: Ignore existing files entirely")
|
|
91
|
+
] = False,
|
|
92
|
+
workers: Annotated[
|
|
93
|
+
Optional[int],
|
|
94
|
+
typer.Option("--workers", "-w", help="Number of threads (default: CPU count)"),
|
|
95
|
+
] = None,
|
|
96
|
+
):
|
|
97
|
+
"""Sync keys between two stores."""
|
|
98
|
+
src_store = get_store(src, **state)
|
|
99
|
+
dst_store = get_store(dst, **state)
|
|
100
|
+
count = sync(
|
|
101
|
+
src_store,
|
|
102
|
+
dst_store,
|
|
103
|
+
delete=delete,
|
|
104
|
+
overwrite=overwrite,
|
|
105
|
+
worm=worm,
|
|
106
|
+
workers=workers,
|
|
107
|
+
)
|
|
108
|
+
typer.echo(f"{count} keys synced")
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
@cli.command("rm")
|
|
112
|
+
def cli_rm(
|
|
113
|
+
uri: str,
|
|
114
|
+
recursive: Annotated[
|
|
115
|
+
bool, typer.Option("--recursive", "-r", help="Delete by prefix")
|
|
116
|
+
] = False,
|
|
117
|
+
):
|
|
118
|
+
"""Delete a key from a store."""
|
|
119
|
+
if recursive:
|
|
120
|
+
store = get_store(uri, **state)
|
|
121
|
+
count = 0
|
|
122
|
+
for k in store.iterate_keys():
|
|
123
|
+
store.delete(k)
|
|
124
|
+
count += 1
|
|
125
|
+
typer.echo(f"{count} keys deleted")
|
|
126
|
+
else:
|
|
127
|
+
res = get_resource(uri, **state)
|
|
128
|
+
res.delete()
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
from anystore.logic.uri import UriHandler
|
|
3
|
+
from anystore.store import Store, get_store as get_anystore
|
|
4
|
+
from anystore.store.resource import UriResource
|
|
5
|
+
from anystore.types import Uri
|
|
6
|
+
from putfs.settings import Settings
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
settings = Settings()
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _is_putfs(uri: Uri | UriHandler) -> bool:
|
|
13
|
+
"""
|
|
14
|
+
Check if given uri is a PutFS endpoint. Valid PutFS schemes are:
|
|
15
|
+
- putfs://
|
|
16
|
+
- anystore+http[s]:// (already anstore compat)
|
|
17
|
+
"""
|
|
18
|
+
if not isinstance(uri, UriHandler):
|
|
19
|
+
uri = UriHandler(uri)
|
|
20
|
+
return uri.scheme.startswith(("putfs", "anystore+"))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _make_anystore_http_uri(uri: Uri | UriHandler) -> str:
|
|
24
|
+
"""Transform a http-like uri into anystore format to tell fsspec which
|
|
25
|
+
storage to use"""
|
|
26
|
+
if not isinstance(uri, UriHandler):
|
|
27
|
+
uri = UriHandler(uri)
|
|
28
|
+
rest = uri.parsed.netloc + uri.parsed.path
|
|
29
|
+
if _is_putfs(uri):
|
|
30
|
+
# putfs[s]:// -> anystore+http[s]://
|
|
31
|
+
proto = "https" if settings.https else "http"
|
|
32
|
+
scheme = uri.scheme.replace("putfs", f"anystore+{proto}")
|
|
33
|
+
return f"{scheme}://{rest}"
|
|
34
|
+
if uri.is_http:
|
|
35
|
+
return f"anystore+{uri.scheme}://{rest}"
|
|
36
|
+
raise ValueError(f"Invalid URI: `{uri}`")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class PutFS(Store):
|
|
40
|
+
def __init__(
|
|
41
|
+
self,
|
|
42
|
+
uri: Uri | None = None,
|
|
43
|
+
key: str | None = None,
|
|
44
|
+
secret: str | None = None,
|
|
45
|
+
**headers: Any,
|
|
46
|
+
) -> None:
|
|
47
|
+
settings = Settings()
|
|
48
|
+
uri = _make_anystore_http_uri(uri or settings.endpoint_url)
|
|
49
|
+
backend_config = {
|
|
50
|
+
"client_kwargs": {
|
|
51
|
+
"headers": {
|
|
52
|
+
"X-Api-Key": key or settings.api_key,
|
|
53
|
+
"X-Api-Secret": secret or settings.api_secret,
|
|
54
|
+
**headers,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
super().__init__(uri=uri, backend_config=backend_config)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def get_store(uri: Uri, **kwargs) -> Store:
|
|
62
|
+
if _is_putfs(uri):
|
|
63
|
+
return PutFS(uri, **kwargs)
|
|
64
|
+
return get_anystore(uri)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class PutFSResource:
|
|
68
|
+
"""Minimal resource wrapper for PutFS stores."""
|
|
69
|
+
|
|
70
|
+
def __init__(self, store: Store, key: str):
|
|
71
|
+
self.store = store
|
|
72
|
+
self.key = key
|
|
73
|
+
|
|
74
|
+
def open(self, **kwargs):
|
|
75
|
+
return self.store.open(self.key, **kwargs)
|
|
76
|
+
|
|
77
|
+
def delete(self, **kwargs):
|
|
78
|
+
self.store.delete(self.key, **kwargs)
|
|
79
|
+
|
|
80
|
+
def exists(self) -> bool:
|
|
81
|
+
return self.store.exists(self.key)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def get_resource(uri: Uri, **kwargs) -> UriResource | PutFSResource:
|
|
85
|
+
if _is_putfs(uri):
|
|
86
|
+
# Split: http://host/dataset/path/file.txt → store=http://host/dataset/path, key=file.txt
|
|
87
|
+
base, key = str(uri).rsplit("/", 1)
|
|
88
|
+
store = PutFS(uri=base, **kwargs)
|
|
89
|
+
return PutFSResource(store, key)
|
|
90
|
+
return UriResource(uri)
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
2
|
+
from multiprocessing import cpu_count
|
|
3
|
+
|
|
4
|
+
from anystore.io import logged_items, stream_bytes
|
|
5
|
+
from anystore.store import Store
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def _needs_transfer(source: Store, target: Store, key: str, worm: bool) -> bool:
|
|
9
|
+
"""Check if key needs transfer by comparing mtime (size fallback)."""
|
|
10
|
+
# short circuit WORM mode:
|
|
11
|
+
if worm and target.exists(key):
|
|
12
|
+
return False
|
|
13
|
+
source_info = source.info(key)
|
|
14
|
+
try:
|
|
15
|
+
target_info = target.info(key)
|
|
16
|
+
except (FileNotFoundError, Exception):
|
|
17
|
+
return True
|
|
18
|
+
if source_info.updated_at and target_info.updated_at:
|
|
19
|
+
return source_info.updated_at > target_info.updated_at
|
|
20
|
+
return source_info.size != target_info.size
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _sync_key(
|
|
24
|
+
source: Store, target: Store, key: str, overwrite: bool, worm: bool
|
|
25
|
+
) -> bool:
|
|
26
|
+
"""Transfer a single key if needed."""
|
|
27
|
+
if not overwrite and not _needs_transfer(source, target, key, worm):
|
|
28
|
+
return False
|
|
29
|
+
stream_bytes(key, source, target)
|
|
30
|
+
return True
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def sync(
|
|
34
|
+
source: Store,
|
|
35
|
+
target: Store,
|
|
36
|
+
delete: bool = False,
|
|
37
|
+
overwrite: bool = False,
|
|
38
|
+
worm: bool = False,
|
|
39
|
+
workers: int | None = None,
|
|
40
|
+
) -> int:
|
|
41
|
+
"""Sync keys from source store to target store using threads.
|
|
42
|
+
|
|
43
|
+
When delete=False (default), only the source is listed – the target
|
|
44
|
+
is not scanned upfront. Each key is checked individually via HEAD
|
|
45
|
+
(unless overwrite=True, which skips all checks).
|
|
46
|
+
|
|
47
|
+
When delete=True, both stores are listed to find extra keys to remove.
|
|
48
|
+
|
|
49
|
+
Returns the number of keys transferred + deleted.
|
|
50
|
+
"""
|
|
51
|
+
workers = workers or cpu_count()
|
|
52
|
+
source_keys = set(source.iterate_keys())
|
|
53
|
+
|
|
54
|
+
# Only list target when we need to find extras to delete
|
|
55
|
+
target_keys = set(target.iterate_keys()) if delete else set()
|
|
56
|
+
|
|
57
|
+
total = len(source_keys)
|
|
58
|
+
count = 0
|
|
59
|
+
|
|
60
|
+
with ThreadPoolExecutor(max_workers=workers) as pool:
|
|
61
|
+
futures = {}
|
|
62
|
+
for key in source_keys:
|
|
63
|
+
futures[pool.submit(_sync_key, source, target, key, overwrite, worm)] = key
|
|
64
|
+
|
|
65
|
+
for future in logged_items(
|
|
66
|
+
as_completed(futures),
|
|
67
|
+
"Syncing",
|
|
68
|
+
total=total,
|
|
69
|
+
item_name="File",
|
|
70
|
+
):
|
|
71
|
+
if future.result():
|
|
72
|
+
count += 1
|
|
73
|
+
|
|
74
|
+
if delete:
|
|
75
|
+
extra = target_keys - source_keys
|
|
76
|
+
for key in extra:
|
|
77
|
+
target.delete(key)
|
|
78
|
+
count += 1
|
|
79
|
+
|
|
80
|
+
return count
|
putfs-0.0.0/putfs/fs.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import fnmatch
|
|
2
|
+
import os
|
|
3
|
+
from email.utils import formatdate
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
import anyio
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def safe_path(root: Path, key: str) -> Path:
|
|
10
|
+
"""Resolve key to an absolute path, raising ValueError on traversal."""
|
|
11
|
+
resolved = (root / key).resolve()
|
|
12
|
+
if not resolved.is_relative_to(root.resolve()):
|
|
13
|
+
raise ValueError("path traversal")
|
|
14
|
+
return resolved
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def format_mtime(mtime: float) -> str:
|
|
18
|
+
"""Format a stat mtime as an RFC 2822 date string."""
|
|
19
|
+
return formatdate(mtime, usegmt=True)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def format_mtime_iso(mtime: float) -> str:
|
|
23
|
+
"""Format a stat mtime as an ISO 8601 date string for S3."""
|
|
24
|
+
from datetime import datetime, timezone
|
|
25
|
+
|
|
26
|
+
return datetime.fromtimestamp(mtime, tz=timezone.utc).strftime(
|
|
27
|
+
"%Y-%m-%dT%H:%M:%S.000Z"
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def etag(stat: os.stat_result) -> str:
|
|
32
|
+
"""Cheap deterministic ETag from file size and mtime."""
|
|
33
|
+
return f'"{hash(f"{stat.st_size}-{stat.st_mtime}"):016x}"'
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
async def iter_keys(
|
|
37
|
+
root: Path,
|
|
38
|
+
base: Path,
|
|
39
|
+
exclude_prefix: str | None = None,
|
|
40
|
+
glob: str | None = None,
|
|
41
|
+
depth: int | None = None,
|
|
42
|
+
):
|
|
43
|
+
"""Async streaming listing via os.scandir, relative to root.
|
|
44
|
+
|
|
45
|
+
depth=None: recursive (all files). depth=1: immediate children only.
|
|
46
|
+
Yields file paths for depth>1 or None, directory names for depth=1.
|
|
47
|
+
"""
|
|
48
|
+
root_str = str(root)
|
|
49
|
+
base_str = str(base)
|
|
50
|
+
queue: list[tuple[str, int]] = [(base_str, 0)]
|
|
51
|
+
while queue:
|
|
52
|
+
current, level = queue.pop()
|
|
53
|
+
try:
|
|
54
|
+
entries = await anyio.to_thread.run_sync(
|
|
55
|
+
lambda d=current: list(os.scandir(d))
|
|
56
|
+
)
|
|
57
|
+
except FileNotFoundError:
|
|
58
|
+
continue
|
|
59
|
+
for entry in entries:
|
|
60
|
+
if entry.is_dir(follow_symlinks=False):
|
|
61
|
+
if depth is not None and depth == 1 and level == 0:
|
|
62
|
+
rel = os.path.relpath(entry.path, root_str)
|
|
63
|
+
yield rel
|
|
64
|
+
elif depth is None or level + 1 < depth:
|
|
65
|
+
queue.append((entry.path, level + 1))
|
|
66
|
+
elif entry.is_file(follow_symlinks=False):
|
|
67
|
+
if depth is not None and depth == 1 and level > 0:
|
|
68
|
+
continue
|
|
69
|
+
rel = os.path.relpath(entry.path, root_str)
|
|
70
|
+
if exclude_prefix and rel.startswith(exclude_prefix):
|
|
71
|
+
continue
|
|
72
|
+
if glob and not fnmatch.fnmatch(rel, glob):
|
|
73
|
+
continue
|
|
74
|
+
yield rel
|
|
File without changes
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import errno
|
|
2
|
+
from base64 import b64decode, b64encode
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from xml.sax.saxutils import escape
|
|
5
|
+
|
|
6
|
+
import anyio
|
|
7
|
+
from starlette.applications import Starlette
|
|
8
|
+
from starlette.middleware import Middleware
|
|
9
|
+
from starlette.middleware.base import BaseHTTPMiddleware
|
|
10
|
+
from starlette.requests import Request
|
|
11
|
+
from starlette.responses import FileResponse, Response
|
|
12
|
+
from starlette.routing import Route
|
|
13
|
+
|
|
14
|
+
from putfs.fs import etag, format_mtime_iso, iter_keys, safe_path
|
|
15
|
+
from putfs.s3.auth import load_key_mapping, verify_sigv4
|
|
16
|
+
from putfs.settings import Settings
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def make_xml_response(body: str, status_code: int = 200) -> Response:
|
|
20
|
+
xml = f'<?xml version="1.0" encoding="UTF-8"?>\n{body}'
|
|
21
|
+
return Response(content=xml, media_type="application/xml", status_code=status_code)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def create_app() -> Starlette:
|
|
25
|
+
settings = Settings()
|
|
26
|
+
root = Path(settings.root).resolve()
|
|
27
|
+
key_mapping = load_key_mapping(settings.s3_keys_dir)
|
|
28
|
+
|
|
29
|
+
# ── Auth middleware ──────────────────────────────────────────────
|
|
30
|
+
|
|
31
|
+
class S3AuthMiddleware(BaseHTTPMiddleware):
|
|
32
|
+
async def dispatch(self, request: Request, call_next):
|
|
33
|
+
from starlette.exceptions import HTTPException
|
|
34
|
+
|
|
35
|
+
try:
|
|
36
|
+
await verify_sigv4(
|
|
37
|
+
request, key_mapping, settings.s3_region, settings.s3_allow_unsigned
|
|
38
|
+
)
|
|
39
|
+
except HTTPException as exc:
|
|
40
|
+
return make_xml_response(
|
|
41
|
+
f"<Error><Code>{exc.status_code}</Code>"
|
|
42
|
+
f"<Message>{escape(exc.detail)}</Message>"
|
|
43
|
+
f"</Error>",
|
|
44
|
+
status_code=exc.status_code,
|
|
45
|
+
)
|
|
46
|
+
return await call_next(request)
|
|
47
|
+
|
|
48
|
+
# ── Bucket ops ───────────────────────────────────────────────────
|
|
49
|
+
|
|
50
|
+
async def list_buckets(request: Request) -> Response:
|
|
51
|
+
buckets = []
|
|
52
|
+
async for name in iter_keys(root, root, depth=1):
|
|
53
|
+
path = root / name
|
|
54
|
+
stat = path.stat()
|
|
55
|
+
buckets.append(
|
|
56
|
+
f"<Bucket>"
|
|
57
|
+
f"<Name>{escape(name)}</Name>"
|
|
58
|
+
f"<CreationDate>{format_mtime_iso(stat.st_mtime)}</CreationDate>"
|
|
59
|
+
f"</Bucket>"
|
|
60
|
+
)
|
|
61
|
+
return make_xml_response(
|
|
62
|
+
f"<ListAllMyBucketsResult>"
|
|
63
|
+
f"<Buckets>{''.join(buckets)}</Buckets>"
|
|
64
|
+
f"</ListAllMyBucketsResult>"
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
async def create_bucket(request: Request) -> Response:
|
|
68
|
+
bucket = request.path_params["bucket"]
|
|
69
|
+
path = safe_path(root, bucket)
|
|
70
|
+
path.mkdir(parents=True, exist_ok=True)
|
|
71
|
+
return Response(status_code=200)
|
|
72
|
+
|
|
73
|
+
async def head_bucket(request: Request) -> Response:
|
|
74
|
+
bucket = request.path_params["bucket"]
|
|
75
|
+
path = safe_path(root, bucket)
|
|
76
|
+
if path.is_dir():
|
|
77
|
+
return Response(status_code=200)
|
|
78
|
+
return Response(status_code=404)
|
|
79
|
+
|
|
80
|
+
async def delete_bucket(request: Request) -> Response:
|
|
81
|
+
bucket = request.path_params["bucket"]
|
|
82
|
+
path = safe_path(root, bucket)
|
|
83
|
+
if not path.is_dir():
|
|
84
|
+
return Response(status_code=404)
|
|
85
|
+
try:
|
|
86
|
+
path.rmdir()
|
|
87
|
+
except OSError:
|
|
88
|
+
return make_xml_response(
|
|
89
|
+
f"<Error><Code>BucketNotEmpty</Code>"
|
|
90
|
+
f"<BucketName>{escape(bucket)}</BucketName>"
|
|
91
|
+
f"<Message>The bucket is not empty.</Message>"
|
|
92
|
+
f"</Error>",
|
|
93
|
+
status_code=409,
|
|
94
|
+
)
|
|
95
|
+
return Response(status_code=204)
|
|
96
|
+
|
|
97
|
+
# ── List objects ─────────────────────────────────────────────────
|
|
98
|
+
|
|
99
|
+
async def list_objects(request: Request) -> Response:
|
|
100
|
+
bucket = request.path_params["bucket"]
|
|
101
|
+
prefix = request.query_params.get("prefix", "")
|
|
102
|
+
delimiter = request.query_params.get("delimiter", "")
|
|
103
|
+
max_keys = int(request.query_params.get("max-keys", "10000"))
|
|
104
|
+
continuation_token = request.query_params.get("continuation-token", "")
|
|
105
|
+
start_after = request.query_params.get("start-after", "")
|
|
106
|
+
|
|
107
|
+
base = safe_path(root, bucket)
|
|
108
|
+
if prefix:
|
|
109
|
+
base = safe_path(root, f"{bucket}/{prefix}")
|
|
110
|
+
|
|
111
|
+
start_key = ""
|
|
112
|
+
if continuation_token:
|
|
113
|
+
start_key = b64decode(continuation_token).decode()
|
|
114
|
+
elif start_after:
|
|
115
|
+
start_key = start_after
|
|
116
|
+
|
|
117
|
+
contents: list[str] = []
|
|
118
|
+
common_prefixes: set[str] = set()
|
|
119
|
+
count = 0
|
|
120
|
+
truncated = False
|
|
121
|
+
last_key = ""
|
|
122
|
+
|
|
123
|
+
async for rel_key in iter_keys(root, base):
|
|
124
|
+
obj_key = (
|
|
125
|
+
rel_key[len(bucket) + 1:]
|
|
126
|
+
if rel_key.startswith(bucket + "/")
|
|
127
|
+
else rel_key
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
if start_key and obj_key <= start_key:
|
|
131
|
+
continue
|
|
132
|
+
|
|
133
|
+
if delimiter and prefix:
|
|
134
|
+
after_prefix = obj_key[len(prefix):]
|
|
135
|
+
delim_pos = after_prefix.find(delimiter)
|
|
136
|
+
if delim_pos >= 0:
|
|
137
|
+
cp = prefix + after_prefix[: delim_pos + 1]
|
|
138
|
+
common_prefixes.add(cp)
|
|
139
|
+
continue
|
|
140
|
+
elif delimiter:
|
|
141
|
+
delim_pos = obj_key.find(delimiter)
|
|
142
|
+
if delim_pos >= 0:
|
|
143
|
+
cp = obj_key[: delim_pos + 1]
|
|
144
|
+
common_prefixes.add(cp)
|
|
145
|
+
continue
|
|
146
|
+
|
|
147
|
+
if count >= max_keys:
|
|
148
|
+
truncated = True
|
|
149
|
+
break
|
|
150
|
+
|
|
151
|
+
file_path = root / rel_key
|
|
152
|
+
try:
|
|
153
|
+
stat = file_path.stat()
|
|
154
|
+
except FileNotFoundError:
|
|
155
|
+
continue
|
|
156
|
+
|
|
157
|
+
contents.append(
|
|
158
|
+
f"<Contents>"
|
|
159
|
+
f"<Key>{escape(obj_key)}</Key>"
|
|
160
|
+
f"<LastModified>{format_mtime_iso(stat.st_mtime)}</LastModified>"
|
|
161
|
+
f"<ETag>{escape(etag(stat))}</ETag>"
|
|
162
|
+
f"<Size>{stat.st_size}</Size>"
|
|
163
|
+
f"<StorageClass>STANDARD</StorageClass>"
|
|
164
|
+
f"</Contents>"
|
|
165
|
+
)
|
|
166
|
+
last_key = obj_key
|
|
167
|
+
count += 1
|
|
168
|
+
|
|
169
|
+
next_token = ""
|
|
170
|
+
if truncated and last_key:
|
|
171
|
+
next_token = b64encode(last_key.encode()).decode()
|
|
172
|
+
|
|
173
|
+
cp_xml = "".join(
|
|
174
|
+
f"<CommonPrefixes><Prefix>{escape(p)}</Prefix></CommonPrefixes>"
|
|
175
|
+
for p in sorted(common_prefixes)
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
body = (
|
|
179
|
+
f"<ListBucketResult>"
|
|
180
|
+
f"<Name>{escape(bucket)}</Name>"
|
|
181
|
+
f"<Prefix>{escape(prefix)}</Prefix>"
|
|
182
|
+
f"<MaxKeys>{max_keys}</MaxKeys>"
|
|
183
|
+
f"<KeyCount>{count}</KeyCount>"
|
|
184
|
+
f"<IsTruncated>{'true' if truncated else 'false'}</IsTruncated>"
|
|
185
|
+
f"{'<Delimiter>' + escape(delimiter) + '</Delimiter>' if delimiter else ''}"
|
|
186
|
+
f"{'<NextContinuationToken>' + escape(next_token) + '</NextContinuationToken>' if next_token else ''}"
|
|
187
|
+
f"{''.join(contents)}"
|
|
188
|
+
f"{cp_xml}"
|
|
189
|
+
f"</ListBucketResult>"
|
|
190
|
+
)
|
|
191
|
+
return make_xml_response(body)
|
|
192
|
+
|
|
193
|
+
# ── Object ops ───────────────────────────────────────────────────
|
|
194
|
+
|
|
195
|
+
async def get_object(request: Request) -> Response:
|
|
196
|
+
bucket = request.path_params["bucket"]
|
|
197
|
+
key = request.path_params["key"]
|
|
198
|
+
path = safe_path(root, f"{bucket}/{key}")
|
|
199
|
+
if not path.is_file():
|
|
200
|
+
return make_xml_response(
|
|
201
|
+
f"<Error><Code>NoSuchKey</Code>"
|
|
202
|
+
f"<Key>{escape(key)}</Key>"
|
|
203
|
+
f"<Message>The specified key does not exist.</Message>"
|
|
204
|
+
f"</Error>",
|
|
205
|
+
status_code=404,
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
stat = path.stat()
|
|
209
|
+
headers = {
|
|
210
|
+
"last-modified": format_mtime_iso(stat.st_mtime),
|
|
211
|
+
"etag": etag(stat),
|
|
212
|
+
}
|
|
213
|
+
if settings.s3_accel_redirect:
|
|
214
|
+
headers["x-accel-redirect"] = f"/_internal/{bucket}/{key}"
|
|
215
|
+
headers["content-length"] = str(stat.st_size)
|
|
216
|
+
return Response(status_code=200, headers=headers)
|
|
217
|
+
return FileResponse(path, headers=headers)
|
|
218
|
+
|
|
219
|
+
async def head_object(request: Request) -> Response:
|
|
220
|
+
bucket = request.path_params["bucket"]
|
|
221
|
+
key = request.path_params["key"]
|
|
222
|
+
path = safe_path(root, f"{bucket}/{key}")
|
|
223
|
+
if not path.is_file():
|
|
224
|
+
return Response(status_code=404)
|
|
225
|
+
stat = path.stat()
|
|
226
|
+
return Response(
|
|
227
|
+
status_code=200,
|
|
228
|
+
headers={
|
|
229
|
+
"content-length": str(stat.st_size),
|
|
230
|
+
"last-modified": format_mtime_iso(stat.st_mtime),
|
|
231
|
+
"etag": etag(stat),
|
|
232
|
+
"accept-ranges": "bytes",
|
|
233
|
+
},
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
async def put_object(request: Request) -> Response:
|
|
237
|
+
bucket = request.path_params["bucket"]
|
|
238
|
+
key = request.path_params["key"]
|
|
239
|
+
path = safe_path(root, f"{bucket}/{key}")
|
|
240
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
241
|
+
try:
|
|
242
|
+
async with await anyio.open_file(path, "wb") as f:
|
|
243
|
+
async for chunk in request.stream():
|
|
244
|
+
await f.write(chunk)
|
|
245
|
+
except OSError as e:
|
|
246
|
+
if e.errno == errno.ENOSPC:
|
|
247
|
+
return Response(status_code=507, content="Insufficient Storage")
|
|
248
|
+
raise
|
|
249
|
+
stat = path.stat()
|
|
250
|
+
return Response(status_code=200, headers={"etag": etag(stat)})
|
|
251
|
+
|
|
252
|
+
async def delete_object(request: Request) -> Response:
|
|
253
|
+
bucket = request.path_params["bucket"]
|
|
254
|
+
key = request.path_params["key"]
|
|
255
|
+
path = safe_path(root, f"{bucket}/{key}")
|
|
256
|
+
try:
|
|
257
|
+
path.unlink()
|
|
258
|
+
except FileNotFoundError:
|
|
259
|
+
pass
|
|
260
|
+
return Response(status_code=204)
|
|
261
|
+
|
|
262
|
+
# ── App ──────────────────────────────────────────────────────────
|
|
263
|
+
|
|
264
|
+
return Starlette(
|
|
265
|
+
routes=[
|
|
266
|
+
Route("/", list_buckets, methods=["GET"]),
|
|
267
|
+
Route("/{bucket}", create_bucket, methods=["PUT"]),
|
|
268
|
+
Route("/{bucket}", head_bucket, methods=["HEAD"]),
|
|
269
|
+
Route("/{bucket}", delete_bucket, methods=["DELETE"]),
|
|
270
|
+
Route("/{bucket}", list_objects, methods=["GET"]),
|
|
271
|
+
Route("/{bucket}/{key:path}", get_object, methods=["GET"]),
|
|
272
|
+
Route("/{bucket}/{key:path}", head_object, methods=["HEAD"]),
|
|
273
|
+
Route("/{bucket}/{key:path}", put_object, methods=["PUT"]),
|
|
274
|
+
Route("/{bucket}/{key:path}", delete_object, methods=["DELETE"]),
|
|
275
|
+
],
|
|
276
|
+
middleware=[Middleware(S3AuthMiddleware)],
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
app = create_app()
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import fnmatch
|
|
2
|
+
import os
|
|
3
|
+
import re
|
|
4
|
+
import posixpath
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from starlette.exceptions import HTTPException
|
|
8
|
+
from starlette.requests import Request
|
|
9
|
+
|
|
10
|
+
# key_id → [(secret, glob), ...]
|
|
11
|
+
KeyMapping = dict[str, list[tuple[str, str]]]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def load_key_mapping(keys_dir: str) -> KeyMapping:
|
|
15
|
+
"""Load key_id → [(secret, glob), ...] mapping from key files.
|
|
16
|
+
|
|
17
|
+
Each file in keys_dir is named after the access key ID.
|
|
18
|
+
Each line is `<secret>:<glob>` where glob controls path access.
|
|
19
|
+
|
|
20
|
+
Example file `keys/s3/AKID_acme`:
|
|
21
|
+
mysecret123:invoices/*
|
|
22
|
+
mysecret123:contracts/*
|
|
23
|
+
othersecret:*
|
|
24
|
+
"""
|
|
25
|
+
mapping: KeyMapping = {}
|
|
26
|
+
keys_path = Path(keys_dir)
|
|
27
|
+
if not keys_path.is_dir():
|
|
28
|
+
return mapping
|
|
29
|
+
for entry in os.scandir(keys_path):
|
|
30
|
+
if entry.is_file() and not entry.name.startswith("."):
|
|
31
|
+
rules = []
|
|
32
|
+
for line in Path(entry.path).read_text().splitlines():
|
|
33
|
+
line = line.strip()
|
|
34
|
+
if not line or line.startswith("#"):
|
|
35
|
+
continue
|
|
36
|
+
if ":" in line:
|
|
37
|
+
secret, glob = line.split(":", 1)
|
|
38
|
+
rules.append((secret.strip(), glob.strip()))
|
|
39
|
+
else:
|
|
40
|
+
# bare secret, no glob restriction (allow all)
|
|
41
|
+
rules.append((line, "*"))
|
|
42
|
+
if rules:
|
|
43
|
+
mapping[entry.name] = rules
|
|
44
|
+
return mapping
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _extract_key_id(auth_header: str) -> str | None:
|
|
48
|
+
"""Extract access key ID from SigV4 Authorization header."""
|
|
49
|
+
m = re.search(r"Credential=([^/]+)/", auth_header)
|
|
50
|
+
return m.group(1) if m else None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
async def verify_sigv4(
|
|
54
|
+
request: Request,
|
|
55
|
+
key_mapping: KeyMapping,
|
|
56
|
+
region: str,
|
|
57
|
+
allow_unsigned: bool = False,
|
|
58
|
+
) -> None:
|
|
59
|
+
"""Verify AWS SigV4 signature and path permissions."""
|
|
60
|
+
auth_header = request.headers.get("authorization", "")
|
|
61
|
+
if not auth_header.startswith("AWS4-HMAC-SHA256"):
|
|
62
|
+
if allow_unsigned:
|
|
63
|
+
return
|
|
64
|
+
raise HTTPException(status_code=403, detail="Missing SigV4 authorization")
|
|
65
|
+
|
|
66
|
+
try:
|
|
67
|
+
import awssig
|
|
68
|
+
except ImportError:
|
|
69
|
+
raise HTTPException(
|
|
70
|
+
status_code=500,
|
|
71
|
+
detail="S3 auth requires awssig: pip install putfs[s3]",
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
key_id = _extract_key_id(auth_header)
|
|
75
|
+
if not key_id or key_id not in key_mapping:
|
|
76
|
+
raise HTTPException(status_code=403, detail="Access Denied")
|
|
77
|
+
|
|
78
|
+
rules = key_mapping[key_id]
|
|
79
|
+
# Normalize path: resolve .. and decode, reject traversal patterns
|
|
80
|
+
raw_path = request.url.path.lstrip("/")
|
|
81
|
+
request_path = posixpath.normpath(raw_path).lstrip("/")
|
|
82
|
+
if ".." in request_path.split("/"):
|
|
83
|
+
raise HTTPException(status_code=403, detail="Access Denied")
|
|
84
|
+
|
|
85
|
+
# Try each secret for this key ID
|
|
86
|
+
verified = False
|
|
87
|
+
for secret, glob_pattern in rules:
|
|
88
|
+
try:
|
|
89
|
+
verifier = awssig.AWSSigV4S3Verifier(
|
|
90
|
+
request_method=request.method,
|
|
91
|
+
uri_path=request.url.path,
|
|
92
|
+
query_string=str(request.url.query) if request.url.query else "",
|
|
93
|
+
headers=dict(request.headers),
|
|
94
|
+
body=b"",
|
|
95
|
+
region=region,
|
|
96
|
+
service="s3",
|
|
97
|
+
key_mapping={key_id: secret},
|
|
98
|
+
timestamp_mismatch=15 * 60,
|
|
99
|
+
)
|
|
100
|
+
verifier.verify()
|
|
101
|
+
# Signature matches – check path permission against normalized path
|
|
102
|
+
if fnmatch.fnmatch(request_path, glob_pattern):
|
|
103
|
+
verified = True
|
|
104
|
+
break
|
|
105
|
+
except awssig.InvalidSignatureError:
|
|
106
|
+
continue
|
|
107
|
+
|
|
108
|
+
if not verified:
|
|
109
|
+
raise HTTPException(status_code=403, detail="Access Denied")
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
BOOL = ("true", "1", "yes")
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Settings:
|
|
8
|
+
"""Settings from environment variables with PUTFS_ prefix."""
|
|
9
|
+
|
|
10
|
+
def __init__(self):
|
|
11
|
+
self.root = os.environ.get("PUTFS_ROOT", "data")
|
|
12
|
+
self.chunk_size = int(os.environ.get("PUTFS_CHUNK_SIZE", str(10 * 1024 * 1024)))
|
|
13
|
+
self.worm_globs = os.environ.get("PUTFS_WORM_GLOBS", "").split(",")
|
|
14
|
+
self.worm_strict = os.environ.get("PUTFS_WORM_STRICT", "false").lower() in BOOL
|
|
15
|
+
self.worm_allow_delete = (
|
|
16
|
+
os.environ.get("PUTFS_WORM_ALLOW_DELETE", "false").lower() in BOOL
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
# client
|
|
20
|
+
self.endpoint_url = os.environ.get(
|
|
21
|
+
"PUTFS_ENDPOINT_URL", "http://localhost:8000"
|
|
22
|
+
)
|
|
23
|
+
self.api_key = os.environ.get("PUTFS_API_KEY", "test-key")
|
|
24
|
+
self.api_secret = os.environ.get("PUTFS_API_SECRET", "test-secret")
|
|
25
|
+
self.https = os.environ.get("PUTFS_HTTPS", "true").lower() in BOOL
|
|
26
|
+
|
|
27
|
+
# s3
|
|
28
|
+
self.s3_keys_dir = os.environ.get("PUTFS_S3_KEYS_DIR", "keys")
|
|
29
|
+
self.s3_region = os.environ.get("PUTFS_S3_REGION", "eu-central-1")
|
|
30
|
+
self.s3_allow_unsigned = (
|
|
31
|
+
os.environ.get("PUTFS_S3_ALLOW_UNSIGNED", "false").lower() in BOOL
|
|
32
|
+
)
|
|
33
|
+
self.s3_accel_redirect = (
|
|
34
|
+
os.environ.get("PUTFS_S3_ACCEL_REDIRECT", "true").lower() in BOOL
|
|
35
|
+
)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "putfs"
|
|
3
|
+
version = "0.0.0"
|
|
4
|
+
description = "Efficient HTTP blob storage over local filesystem"
|
|
5
|
+
authors = [
|
|
6
|
+
{ name = "Simon Wörpel", email = "simon.woerpel@pm.me" },
|
|
7
|
+
{ name = "Data and Research Center – DARC", email = "hi@dataresearchcenter.org" },
|
|
8
|
+
]
|
|
9
|
+
license = "Apache-2.0"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"Operating System :: OS Independent",
|
|
14
|
+
"Programming Language :: Python",
|
|
15
|
+
"Programming Language :: Python :: 3.13",
|
|
16
|
+
"Programming Language :: Python :: 3.14",
|
|
17
|
+
]
|
|
18
|
+
requires-python = ">=3.13,<4"
|
|
19
|
+
dependencies = [
|
|
20
|
+
"starlette (>=1.0.0,<2.0.0)",
|
|
21
|
+
"anyio (>=4.13.0,<5.0.0)",
|
|
22
|
+
"granian (>=2.7.2,<3.0.0)",
|
|
23
|
+
"uvloop (>=0.22.1,<0.23.0)",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[project.optional-dependencies]
|
|
27
|
+
client = ["anystore (>=1.1.7,<2.0.0)"]
|
|
28
|
+
s3 = ["awssig (>=0.5.0)"]
|
|
29
|
+
|
|
30
|
+
[project.scripts]
|
|
31
|
+
putfs = "putfs.cli:cli"
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://putf.sh"
|
|
35
|
+
Repository = "https://github.com/dataresearchcenter/putfs"
|
|
36
|
+
Issues = "https://github.com/dataresearchcenter/putfs/issues"
|
|
37
|
+
|
|
38
|
+
[tool.poetry.group.dev.dependencies]
|
|
39
|
+
pytest = "^9.0.2"
|
|
40
|
+
pytest-cov = ">=4.1,<8.0"
|
|
41
|
+
pytest-env = "^1.6.0"
|
|
42
|
+
black = ">=23.11,<27.0"
|
|
43
|
+
isort = "^8.0.1"
|
|
44
|
+
mypy = "^1.17.1"
|
|
45
|
+
pre-commit = "^4.0.1"
|
|
46
|
+
flake8 = ">=6.1,<8.0"
|
|
47
|
+
ipdb = "^0.13.13"
|
|
48
|
+
bump2version = "^1.0.1"
|
|
49
|
+
pytest-asyncio = ">=0.23.8,<1.4.0"
|
|
50
|
+
httpx = "^0.28.1"
|
|
51
|
+
boto3 = "^1.38.0"
|
|
52
|
+
uvicorn = "^0.34.0"
|
|
53
|
+
zensical = "^0.0.36"
|
|
54
|
+
|
|
55
|
+
[build-system]
|
|
56
|
+
requires = ["poetry-core"]
|
|
57
|
+
build-backend = "poetry.core.masonry.api"
|
|
58
|
+
|
|
59
|
+
[tool.pytest.ini_options]
|
|
60
|
+
markers = [
|
|
61
|
+
"docker: requires docker compose stack running",
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
[tool.pytest_env]
|
|
65
|
+
DEBUG = 1
|
|
66
|
+
PUTFS_ROOT = "./test-data"
|
|
67
|
+
PUTFS_ENDPOINT_URL = "http://localhost:8000"
|
|
68
|
+
PUTFS_HTTPS = 0
|
|
69
|
+
PUTFS_API_KEY = "test-key"
|
|
70
|
+
PUTFS_API_SECRET = "test-secret"
|
|
71
|
+
PUTFS_S3_KEYS_DIR = "./contrib/keys/s3"
|
|
72
|
+
PUTFS_S3_REGION = "eu-central-1"
|
|
73
|
+
PUTFS_S3_ALLOW_UNSIGNED = "false"
|
|
74
|
+
PUTFS_S3_ACCEL_REDIRECT = "false"
|
|
75
|
+
AWS_ACCESS_KEY_ID = "test-key"
|
|
76
|
+
AWS_SECRET_ACCESS_KEY = "test-secret"
|
|
77
|
+
AWS_DEFAULT_REGION = "eu-central-1"
|
|
78
|
+
AWS_ENDPOINT_URL = "http://localhost:8000"
|