Merge branch 'main' into logs
This commit is contained in:
commit
5e7146dc2e
6
.env.example
Normal file
6
.env.example
Normal file
|
@ -0,0 +1,6 @@
|
|||
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,9 +28,15 @@ func insertPaste(key string, content string, secret string, ttl time.Duration) {
|
|||
content: content,
|
||||
secret: secret,
|
||||
}
|
||||
connectDB().HSet(ctx, key, "content", hash.content)
|
||||
connectDB().HSet(ctx, key, "secret", hash.secret)
|
||||
db := connectDB()
|
||||
db.HSet(ctx, key, "content", hash.content)
|
||||
db.HSet(ctx, key, "secret", hash.secret)
|
||||
if ttl > -1 {
|
||||
connectDB().Do(ctx, key, ttl)
|
||||
}
|
||||
}
|
||||
|
||||
func getContent(key string) string {
|
||||
db := connectDB()
|
||||
return db.HGet(ctx, key, "content").Val()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue