-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from chrisfosterelli/README
Add README and License
- Loading branch information
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Two Story Robot | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# simple-file-upload | ||
|
||
Docker container that provides an API endpoint for simple, secure file uploads. | ||
|
||
This docker container exposes a single, write-only endpoint at `/upload` that | ||
accepts a single file along with a `token` GET parameter for authentication. The | ||
authentication for the endpoint, along with the location of the uploaded file, | ||
is configured using environment variables on the container. | ||
|
||
You can upload a file with curl like so: | ||
|
||
```bash | ||
> curl -XPOST -F 'data=@testuser-file.txt' dockerhost:3000/upload?key=TESTUSER | ||
``` | ||
|
||
Multiple keys are supported, and every key is a 1:1 mapping to a location on | ||
disk. Any additional uploads for a key will override the previous upload for | ||
that key. | ||
|
||
The design goals for this container are a secure upload tool that: | ||
1. Can only be used to upload files, not download or read them | ||
2. Can only be used with a matching authentication key | ||
3. Can only upload to a single location per authentication key | ||
4. Can only override the previous upload, not store additional uploads | ||
|
||
# How to Use | ||
|
||
Basic usage is as follows: | ||
|
||
``` | ||
docker run \ | ||
-e "KEY_TESTUSER=/uploads/testuser-file.txt" \ | ||
-v /my_local_dir/:/uploads/ \ | ||
-p 3000:3000 \ | ||
twostoryrobot/simple-file-upload | ||
``` | ||
|
||
This will start the upload server, listening on port 3000. Files that are | ||
uploaded with the key `TESTUSER` will be placed at `/uploads/testuser-file.txt`. | ||
You can use a volume to get easy access to this file on your host machine, or in | ||
another container. |