| Name | Env |
|---|---|
bind-address (0.0.0.0:1337) |
BIND_ADDRESS |
token |
TOKEN |
root-file-directory (./tmp) |
ROOT_FILE_DIRECTORY |
enable-secure (false) |
ENABLE_SECURE |
secure-type (0) |
SECURE_TYPE |
users (./tmp) |
USERS |
- Simple token auth (default)
--secure-type 0
--enable-secure
--token='token_here'- token: With this parameter, you can protect yourself from unauthorized access, it can be empty, if empty-it is generated automatically
| From | Usage |
|---|---|
| Request header | Authorization: Bearer <token> |
| Query param | ?token=<token> |
| Form value | token=<token> |
- HTTP Basic auth
--secure-type 1
--enable-secure
--users='qwx:1337'
--users='qwx2:13372'
--users='qwx3:13373'- JWT based auth
// todo$ curl -i -X POST \
-H "Content-Type: multipart/form-data" \
-F "[email protected]" \
http://localhost:1337?token=123456$ curl -i -X POST \
-H "Content-Type: multipart/form-data" \
-F "[email protected]" \
http://qwx:1337@localhost:1337// todo$ curl -i -X POST \
-H "Content-Type: multipart/form-data" \
-F "files[][email protected]" \
-F "files[][email protected]" \
http://localhost:1337?token=123456$ curl -i -X POST \
--data-binary @.gitignore \
http://localhost:1337/.gitignore?token=123456The name from the request URI will be taken into account as the file name
To view the files just click on the link with the domain, and the file name at the end:
Simple
HTTP Basic
$ git clone https://github.com/zikwall/go-fileserver$ go run . --bind-address localhost:1337 --token 123456 --enable-secure
$ docker run -d -p 1338:1338 \
-e BIND_ADDRESS='0.0.0.0:1338' \
-e SECURE_TYPE=1 \
-e USERS='username:password' \
-e ENABLE_SECURE='true' \
-e ENABLE_TSL='true' \
-e TSL_CERT_FILE='/mnt/ssl.cert' \
-e TSL_KEY_FILE='/mnt/ssl.key' \
-v $HOME/tmp:/app/tmp \
-v $PWD:/mnt \
--name go-fileserver-example qwx1337/go-fileserver:latest$ go test -v ./...