Paste-click is meant to serve as an online clipboard and provides easy interaction with files via curl.
Currently, this tool only requires:
The tool can be built and run entirely via docker using the following command.
$> make build-docker
The tool can also be built and installed locally by running a pip install from the root of the project.
$> make build
Testing is done using the stdlib testing package and full unit tests can be run with the following command.
$> make test
A docker-compose environment has been included to ease both testing. This can be started with the minimal
docker-compose up command.
This exposes the openresty service on port localhost:8080 and files can be uploaded by posting to this address with the Host header set to
$> echo 'hello' | curl -sD - 'http://localhost:8080/' -H 'Host: paste.click' --data-binary @- HTTP/1.1 200 OK Server: openresty/126.96.36.199 Date: Wed, 20 Feb 2019 23:37:24 GMT Content-Type: text/plain; charset=utf-8 Content-Length: 45 Connection: keep-alive Content-Disposition: filename="" Access-Control-Allow-Origin: * http://localhost:8080/sZRqySSS0jR8YjW00mERhA
This object can then be queried with the following command.
$> curl -sD - 'http://localhost:8080/sZRqySSS0jR8YjW00mERhA' -H 'Host: paste.click' Content-Type: text/plain Content-Length: 6 Last-Modified: Thu, 03 Jan 2019 00:41:59 GMT Connection: keep-alive PC-Mime-type: text/plain PC-Size: 6 PC-Object: sZRqySSS0jR8YjW00mERhA PC-Uploaded: 2019-01-03 00:41:59.139780917 +0000 UTC m=+64.410846356 ETag: "5c2d5a57-6" PC-Metafile: hit Accept-Ranges: bytes hello
Configuration parameters are provided via environment variables. Currently the following parameters can be set.
The bind address for the service
A configuration setting representing the returned domain name in all upload calls.
A boolean value determining whether to enable logging of requests to stdout.
The backend storage driver to use. Currently these options are mock, fs and gcs.
The base path of the to store files under. This should always point to the document root of openresty.