A tiny pastebin alternative for self-hosting.
My goals with this project are as follows:
- Learn rust by getting it wrong the first time on a low-stakes project
- Keep the feature set small.
There is no form for creating a paste. Either use curl
directly, or configure a program like ShareX on Windows.
Uploading is done via a multipart/form-data
POST request to a path of /
. The first part of the request will be used as the text content.
cat my-cool-file.txt | curl -H "Authorization: Bearer <your-secret-token>" -F file=@- http://localhost:80
Either build and run it yourself, or use the provided Docker images.
# Before running, add environment variables to `.env`
cargo run
# OR
docker run \
-e PASTE_BEARER_TOKEN=<your-secret-token> \
-p <port-on-host>:80 \
-v <path-on-host>:/app/pastes \
ghcr.io/s-thom/paste
Configuration is done through environment variables. Use of a .env
file is supported for convenience.
Variable Name | Description | Default |
---|---|---|
PASTE_DIR | Directory to store pastes | pastes |
PASTE_BEARER_TOKEN | A secret that must be provided to create new pastes | |
SERVER_HOST | Host for the app to listen on | 127.0.0.1 |
SERVER_PORT | Port for the app to listen on | 80 |
- Read files from directory
- Write files to directory
- Configuration for directory (env variable)
- Simple bearer token authentication for creating new pastes