This commit is contained in:
parent
ec958071b2
commit
4f9e4f1233
@ -203,7 +203,7 @@ func updateKVConfig(s *discovery.Service, oldCnf *server.Config) error { // FIXM
|
|||||||
}
|
}
|
||||||
|
|
||||||
if data == nil {
|
if data == nil {
|
||||||
return errors.New("empty KV config data. Skipping")
|
return errors.New("empty KV config data")
|
||||||
}
|
}
|
||||||
|
|
||||||
buf := bytes.NewBuffer(data.Value)
|
buf := bytes.NewBuffer(data.Value)
|
||||||
|
@ -3,7 +3,7 @@ module git.pbiernat.dev/egommerce/basket-service
|
|||||||
go 1.18
|
go 1.18
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.pbiernat.dev/egommerce/go-api-pkg v0.0.108
|
git.pbiernat.dev/egommerce/go-api-pkg v0.0.113
|
||||||
github.com/georgysavva/scany/v2 v2.0.0
|
github.com/georgysavva/scany/v2 v2.0.0
|
||||||
github.com/gofiber/fiber/v2 v2.40.1
|
github.com/gofiber/fiber/v2 v2.40.1
|
||||||
github.com/jackc/pgtype v1.12.0
|
github.com/jackc/pgtype v1.12.0
|
||||||
|
@ -8,6 +8,8 @@ git.pbiernat.dev/egommerce/go-api-pkg v0.0.106 h1:kOqDvQfk8MzmyQonMMLmZKhW7I5YeD
|
|||||||
git.pbiernat.dev/egommerce/go-api-pkg v0.0.106/go.mod h1:nAwcw2MZtn/54YKq8VQK6RJAsiuoLUtPuazXg8JcqK8=
|
git.pbiernat.dev/egommerce/go-api-pkg v0.0.106/go.mod h1:nAwcw2MZtn/54YKq8VQK6RJAsiuoLUtPuazXg8JcqK8=
|
||||||
git.pbiernat.dev/egommerce/go-api-pkg v0.0.108 h1:gr5kzKNR3sCxTz+nbqtOM7vdIely5ZWb8itSLAjTo0I=
|
git.pbiernat.dev/egommerce/go-api-pkg v0.0.108 h1:gr5kzKNR3sCxTz+nbqtOM7vdIely5ZWb8itSLAjTo0I=
|
||||||
git.pbiernat.dev/egommerce/go-api-pkg v0.0.108/go.mod h1:nAwcw2MZtn/54YKq8VQK6RJAsiuoLUtPuazXg8JcqK8=
|
git.pbiernat.dev/egommerce/go-api-pkg v0.0.108/go.mod h1:nAwcw2MZtn/54YKq8VQK6RJAsiuoLUtPuazXg8JcqK8=
|
||||||
|
git.pbiernat.dev/egommerce/go-api-pkg v0.0.113 h1:kf7HesezhXIAMNYgLCm8x6YVqyLqJRqaPKIFEXf4xSs=
|
||||||
|
git.pbiernat.dev/egommerce/go-api-pkg v0.0.113/go.mod h1:nAwcw2MZtn/54YKq8VQK6RJAsiuoLUtPuazXg8JcqK8=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
|
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
|
||||||
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
|
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
|
||||||
|
@ -3,6 +3,7 @@ package server
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
@ -117,14 +118,18 @@ func (s *Server) GetRequestID(c *fiber.Ctx) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) updateKVConfig() error { // FIXME: duplicated in cmd/worker/main.go
|
func (s *Server) updateKVConfig() error { // FIXME: duplicated in cmd/worker/main.go
|
||||||
data, _, err := s.discovery.KV().Get(s.kvNmspc, nil)
|
config, _, err := s.discovery.KV().Get(s.kvNmspc, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
kvCnf := bytes.NewBuffer(data.Value)
|
if config == nil {
|
||||||
|
return errors.New("empty KV config data")
|
||||||
|
}
|
||||||
|
|
||||||
|
kvCnf := bytes.NewBuffer(config.Value)
|
||||||
decoder := json.NewDecoder(kvCnf)
|
decoder := json.NewDecoder(kvCnf)
|
||||||
if err := decoder.Decode(&s.conf); err != nil {
|
if err := decoder.Decode(&s.conf); err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user