summaryrefslogtreecommitdiff
path: root/internal/server/handler/handler.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-08-12 09:46:37 +0300
committerPaul Buetow <paul@buetow.org>2024-08-12 09:46:37 +0300
commit3e50142dc3932acb618a0bc030e8530c6c1e736c (patch)
tree9861baddb2567959c99b23565122e0e9e720b36b /internal/server/handler/handler.go
parent36560e8aad76a8ea9edc5c10869a2b55a832d62c (diff)
refactor config handling in repository
Diffstat (limited to 'internal/server/handler/handler.go')
-rw-r--r--internal/server/handler/handler.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/server/handler/handler.go b/internal/server/handler/handler.go
index 835f3fb..603e37c 100644
--- a/internal/server/handler/handler.go
+++ b/internal/server/handler/handler.go
@@ -40,7 +40,7 @@ func (h Handler) Submit(ctx context.Context, w http.ResponseWriter, r *http.Requ
if err != nil {
return err
}
- return repository.Instance(h.conf.DataDir).Merge(ent)
+ return repository.Instance(h.conf).Merge(ent)
}
func (h Handler) List(w http.ResponseWriter, r *http.Request) error {
@@ -48,7 +48,7 @@ func (h Handler) List(w http.ResponseWriter, r *http.Request) error {
return fmt.Errorf("expexted GET request")
}
- list, err := repository.Instance(h.conf.DataDir).ListBytes()
+ list, err := repository.Instance(h.conf).ListBytes()
if err != nil {
return err
}
@@ -63,7 +63,7 @@ func (h Handler) Get(w http.ResponseWriter, r *http.Request) error {
return fmt.Errorf("invalid id %s", id)
}
- ent, ok := repository.Instance(h.conf.DataDir).Get(id)
+ ent, ok := repository.Instance(h.conf).Get(id)
if !ok {
return fmt.Errorf("no entry with id %s found", id)
}
@@ -93,7 +93,7 @@ func (h Handler) mergeFromPartner(ctx context.Context, partner string) error {
var (
errs []error
uri = fmt.Sprintf("%s/list", partner)
- repo = repository.Instance(h.conf.DataDir)
+ repo = repository.Instance(h.conf)
pairs []repository.EntryPair
)