Replace redis client, move expiry into creation interface

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2023-06-10 01:36:01 +02:00
parent 900d816dff
commit ea631beeef
No known key found for this signature in database
GPG key ID: D91C3E91E4CAD6F5
8 changed files with 51 additions and 80 deletions

3
api.go
View file

@ -4,6 +4,7 @@ import (
"encoding/json"
"net/http"
"strings"
"time"
"github.com/gorilla/mux"
)
@ -53,7 +54,7 @@ func (a apiServer) handleCreate(res http.ResponseWriter, r *http.Request) {
return
}
id, err := a.store.Create(secret)
id, err := a.store.Create(secret, time.Duration(cfg.SecretExpiry)*time.Second)
if err != nil {
a.errorResponse(res, http.StatusInternalServerError, err.Error())
return