small refactor

This commit is contained in:
2026-04-21 06:00:03 +02:00
parent 4b62a9a64b
commit 26924a5c01
27 changed files with 2149 additions and 789 deletions
+33 -19
View File
@@ -1,30 +1,44 @@
# pastebin
a simple and lightweight pastebin service written in go and templ
[![Go Version](https://img.shields.io/badge/Go-1.25+-00ADD8?style=flat-square&logo=go)](https://go.dev/)
[![Docker Image](https://img.shields.io/badge/Docker-ghcr.io%2Fskidoodle%2Fpastebin-blue?style=flat-square&logo=docker)](https://github.com/skidoodle/pastebin/pkgs/container/pastebin)
## Usage
A minimalist, high-performance paste service written in Go.
```
$ ./pastebin -help
## Deployment
Usage of ./pastebin:
-addr string
socket address to bind to (default ":3000")
-db-path string
path to the database file (default "pastebin.db")
-max-size int
maximum size of a paste in bytes (default 32kB)
-ttl duration
time to live for pastes (e.g., 72h, 30m) (default 168h0m0s)
### Docker Compose
```yaml
services:
pastebin:
image: ghcr.io/skidoodle/pastebin:latest
container_name: pastebin
restart: unless-stopped
ports:
- "3000:3000"
volumes:
- ./data:/app/database
```
## Highlighting
### Manual Installation
To get syntax highlighting, you must add the file extension at the end of your paste URL: `/<paste_id>.<extension>`
Requires Go 1.25 or higher.
Supported languages can be found [here](https://github.com/alecthomas/chroma/tree/master?tab=readme-ov-file#supported-languages)
```bash
go build -o pastebin .
./pastebin -addr :3000 -db-path pastebin.db
```
### Themes
Themes can be applied by specifying in the URL: `/<paste_id>.<extension>/<theme>`
## Configuration
[List of available themes](https://github.com/alecthomas/chroma/tree/master/styles)
| Flag | Description | Default |
| :--- | :--- | :--- |
| `-addr` | Socket address to bind to. | `:3000` |
| `-db-path` | Path to the BoltDB database file. | `pastebin.db` |
| `-max-size` | Maximum allowed paste size in bytes. | `10485760` |
| `-ttl` | Time to live for pastes before expiration. | `168h0m0s` |
## License
This project is licensed under the [GNU General Public License v3.0](LICENSE).