mirror of
https://github.com/taigrr/pastebin
synced 2026-04-12 09:31:28 -07:00
chore: standards, idioms, and CI cleanup
- Update .drone.yml to use Go 1.26 image and modern test commands - Remove outdated release script (referenced go.rice and prologic) - Remove Jekyll config (_config.yml) - Update README with correct module path and modern CLI flags - Update .dockerignore to exclude unnecessary files - All checks pass: go build, go vet, staticcheck, go test -race, goimports
This commit is contained in:
@@ -1 +1,5 @@
|
||||
Dockerfile
|
||||
.git
|
||||
.drone.yml
|
||||
*.md
|
||||
coverage.txt
|
||||
|
||||
17
.drone.yml
17
.drone.yml
@@ -3,23 +3,14 @@ name: default
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: golang:latest
|
||||
image: golang:1.26
|
||||
commands:
|
||||
- make test
|
||||
- make install
|
||||
- go build ./...
|
||||
- go vet ./...
|
||||
- go test -v -cover -coverprofile=coverage.txt -covermode=atomic -coverpkg=./... -race ./...
|
||||
|
||||
- name: coverage
|
||||
image: plugins/codecov
|
||||
settings:
|
||||
token:
|
||||
from_secret: codecov-token
|
||||
|
||||
- name: notify
|
||||
image: plugins/webhook
|
||||
settings:
|
||||
urls:
|
||||
- https://msgbus.mills.io/ci.mills.io
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
- failure
|
||||
|
||||
54
README.md
54
README.md
@@ -7,43 +7,37 @@
|
||||
|
||||
pastebin is a self-hosted pastebin web app that lets you create and share
|
||||
"ephemeral" data between devices and users. There is a configurable expiry
|
||||
(TTL) afterwhich the paste expires and is purged. There is also a handy
|
||||
(TTL) after which the paste expires and is purged. There is also a handy
|
||||
CLI for interacting with the service in a easy way or you can also use curl!
|
||||
|
||||
### Source
|
||||
|
||||
```#!bash
|
||||
$ go get github.com/taigrr/pastebin/...
|
||||
```bash
|
||||
go install github.com/taigrr/pastebin@latest
|
||||
go install github.com/taigrr/pastebin/cmd/pb@latest
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Run pastebin:
|
||||
|
||||
```#!bash
|
||||
$ pastebin
|
||||
```bash
|
||||
pastebin
|
||||
```
|
||||
|
||||
Create a paste:
|
||||
|
||||
```#!bash
|
||||
$ echo "Hello World" | pb
|
||||
http://localhost:8000/92sHUeGPfoFctazBxdEhae
|
||||
```bash
|
||||
echo "Hello World" | pb
|
||||
http://localhost:8000/p/92sHUeGPfo
|
||||
```
|
||||
|
||||
Or use the Web UI: http://localhost:8000/
|
||||
|
||||
Or curl:
|
||||
|
||||
```#bash
|
||||
$ echo "Hello World" | curl -q -L --form blob='<-' -o - http://localhost:8000/
|
||||
...
|
||||
```
|
||||
|
||||
There is also an included command line utility for convenience:
|
||||
|
||||
```#!bash
|
||||
echo hello | pb
|
||||
```bash
|
||||
echo "Hello World" | curl -q -L --form blob='<-' -o - http://localhost:8000/
|
||||
```
|
||||
|
||||
## Configuration
|
||||
@@ -52,26 +46,22 @@ When running the `pastebin` server there are a few default options you might
|
||||
want to tweak:
|
||||
|
||||
```
|
||||
$ ./pastebin --help
|
||||
$ pastebin --help
|
||||
...
|
||||
-expiry duration
|
||||
expiry time for pastes (default 5m0s)
|
||||
-fqdn string
|
||||
FQDN for public access (default "localhost")
|
||||
--expiry duration expiry time for pastes (default 5m0s)
|
||||
--fqdn string FQDN for public access (default "localhost")
|
||||
--bind string address and port to bind to (default "0.0.0.0:8000")
|
||||
```
|
||||
|
||||
Setting a custom `-expiry` lets you change when pastes are automatically
|
||||
expired (*the purge time is 2x this value*). The ``-fqdn` option is used as
|
||||
a namespace for generating the UUID(s) for pastes, change this to be your
|
||||
domain name.
|
||||
Setting a custom `--expiry` lets you change when pastes are automatically
|
||||
expired (*the purge time is 2x this value*). The `--fqdn` option is used as
|
||||
a namespace for the service.
|
||||
|
||||
The command-line utility by default talk to http://localhost:8000 which can be
|
||||
changed via the `-url` option or by creating a `$HOME/.pastebin.conf`
|
||||
configuration file with contents similar to:
|
||||
The command-line utility by default talks to http://localhost:8000 which can
|
||||
be changed via the `--url` flag:
|
||||
|
||||
```
|
||||
$ cat ~/.pastebin.conf
|
||||
url=https://paste.mydomain.com/
|
||||
```bash
|
||||
pb --url https://paste.mydomain.com/
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
theme: jekyll-theme-hacker
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo -n "Version to tag: "
|
||||
read TAG
|
||||
|
||||
echo -n "Name of release: "
|
||||
read NAME
|
||||
|
||||
echo -n "Desc of release: "
|
||||
read DESC
|
||||
|
||||
git tag ${TAG}
|
||||
git push --tags
|
||||
|
||||
if [ ! -d ./bin ]; then
|
||||
mkdir bin
|
||||
else
|
||||
rm -rf ./bin/*
|
||||
fi
|
||||
|
||||
echo -n "Building binaries ... "
|
||||
|
||||
rice embed-go
|
||||
|
||||
GOOS=linux GOARCH=amd64 go build -o ./bin/pastebin-Linux-x86_64 .
|
||||
GOOS=linux GOARCH=arm64 go build -o ./bin/pastebin-Linux-x86_64 .
|
||||
GOOS=darwin GOARCH=amd64 go build -o ./bin/pastebin-Darwin-x86_64 .
|
||||
GOOS=windows GOARCH=amd64 go build -o ./bin/pastebin-Windows-x86_64.exe .
|
||||
|
||||
echo "DONE"
|
||||
|
||||
echo -n "Uploading binaries ... "
|
||||
|
||||
github-release release \
|
||||
-u prologic -p -r pastebin \
|
||||
-t ${TAG} -n "${NAME}" -d "${DESC}"
|
||||
|
||||
for file in bin/*; do
|
||||
name="$(echo $file | sed -e 's|bin/||g')"
|
||||
github-release upload -u prologic -r pastebin -t ${TAG} -n $name -f $file
|
||||
done
|
||||
|
||||
echo "DONE"
|
||||
Reference in New Issue
Block a user