Compare commits
No commits in common. "19f56f96cda3eabd6d78f888db9f160c6dd74fe0" and "30185478769bcb7e10ff97a4249d051e14c20074" have entirely different histories.
19f56f96cd
...
3018547876
3 changed files with 3 additions and 15 deletions
|
@ -1,6 +0,0 @@
|
||||||
PLAKKEN_HOST=0.0.0.0
|
|
||||||
PLAKKEN_PORT=3000
|
|
||||||
PLAKKEN_REDIS_ADDR=localhost:6379
|
|
||||||
PLAKKEN_REDIS_USER=
|
|
||||||
PLAKKEN_REDIS_PASSWORD=
|
|
||||||
PLAKKEN_REDIS_DB=0
|
|
10
db.go
10
db.go
|
@ -28,15 +28,9 @@ func insertPaste(key string, content string, secret string, ttl time.Duration) {
|
||||||
content: content,
|
content: content,
|
||||||
secret: secret,
|
secret: secret,
|
||||||
}
|
}
|
||||||
db := connectDB()
|
connectDB().HSet(ctx, key, "content", hash.content)
|
||||||
db.HSet(ctx, key, "content", hash.content)
|
connectDB().HSet(ctx, key, "secret", hash.secret)
|
||||||
db.HSet(ctx, key, "secret", hash.secret)
|
|
||||||
if ttl > -1 {
|
if ttl > -1 {
|
||||||
connectDB().Do(ctx, key, ttl)
|
connectDB().Do(ctx, key, ttl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getContent(key string) string {
|
|
||||||
db := connectDB()
|
|
||||||
return db.HGet(ctx, key, "content").Val()
|
|
||||||
}
|
|
||||||
|
|
2
main.go
2
main.go
|
@ -11,7 +11,7 @@ import (
|
||||||
var currentConfig config
|
var currentConfig config
|
||||||
|
|
||||||
func handleRequest(w http.ResponseWriter, r *http.Request) {
|
func handleRequest(w http.ResponseWriter, r *http.Request) {
|
||||||
path := strings.ReplaceAll(r.URL.Path, "/raw", "")
|
path := r.URL.Path
|
||||||
switch r.Method {
|
switch r.Method {
|
||||||
case "GET":
|
case "GET":
|
||||||
if path == "/" {
|
if path == "/" {
|
||||||
|
|
Loading…
Reference in a new issue