diff --git a/.app.config b/.app.config new file mode 100644 index 0000000..b839748 --- /dev/null +++ b/.app.config @@ -0,0 +1,16 @@ +{ + "ID": "catalog", + "Name": "catalog", + "Address": "__IP__", + "Tags": ["catalogs-svc", "catalog", "https", "service"], + "Port": 80, + "Connect": { + "Native": true + }, + "Check": { + "TCP": "__IP__:80", + "Interval": "10s", + "Timeout": "10s", + "DeregisterCriticalServiceAfter": "5m" + } +} \ No newline at end of file diff --git a/.env.dist b/.env.dist index 84c5d45..fba2265 100644 --- a/.env.dist +++ b/.env.dist @@ -1,4 +1,14 @@ SERVER_ADDR=:80 + +APP_NAME=catalog-svc +APP_DOMAIN=catalog.service.ego.io +APP_PATH_PREFIX=/catalog +APP_KV_NAMESPACE=dev.egommerce/service/catalog-svc + +LOGGER_ADDR=logger.service.ego.io:24224 +REGISTRY_ADDR=api-registry:8500 DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce +CACHE_ADDR=cache.service.ego.io:6379 +CACHE_PASSWORD=12345678 MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017 EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c1faf5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.env +.env.* +!.env.dist + +.vscode/ +__debug_bin \ No newline at end of file diff --git a/Dockerfile.builder b/Dockerfile.builder index 6ccc27d..9524430 100644 --- a/Dockerfile.builder +++ b/Dockerfile.builder @@ -5,6 +5,7 @@ ARG BIN_OUTPUT=/go/bin ARG GO_SERVER=cmd/server/main.go ARG GO_MIGRATE=cmd/migrate/main.go ARG GO_WORKER=cmd/worker/main.go +ARG GO_HEALTH=cmd/health/main.go WORKDIR /go/src/app COPY src ./ @@ -12,4 +13,5 @@ COPY src ./ RUN export CGO_ENABLED=0 ; export GOOS=linux ; export GOARCH=amd64 && \ go build -ldflags="-w -s" -o "$BIN_OUTPUT/server" $GO_SERVER && \ go build -ldflags="-w -s" -o "$BIN_OUTPUT/migrate" $GO_MIGRATE && \ - go build -ldflags="-w -s" -o "$BIN_OUTPUT/worker" $GO_WORKER + go build -ldflags="-w -s" -o "$BIN_OUTPUT/worker" $GO_WORKER && \ + go build -ldflags="-w -s" -o "$BIN_OUTPUT/health" $GO_HEALTH diff --git a/Dockerfile.target b/Dockerfile.target index 890a401..cb3421c 100644 --- a/Dockerfile.target +++ b/Dockerfile.target @@ -19,12 +19,18 @@ LABEL dev.egommerce.image.build_time=${BUILD_TIME} WORKDIR / COPY --from=builder $BIN_OUTPUT /app -COPY --from=builder /go/bin/migrate /bin/go_migrate +COPY --from=builder /go/bin/migrate /bin/migrate +COPY --from=builder /go/bin/health /bin/health COPY .env.dist /.env +COPY ./.app.config / COPY ./bin /bin RUN chmod 755 /bin/entrypoint.sh /bin/migrate.sh +RUN apk add curl + EXPOSE 80 -CMD ["sh", "-c", "/app"] ENTRYPOINT ["entrypoint.sh"] +CMD ["sh", "-c", "/app"] + +# HEALTHCHECK --interval=5s --timeout=1s --retries=20 CMD health >/dev/null || exit 1 diff --git a/bin/entrypoint.sh b/bin/entrypoint.sh index 01a6dc9..3481607 100755 --- a/bin/entrypoint.sh +++ b/bin/entrypoint.sh @@ -8,20 +8,32 @@ waitForService() while [ $status != 0 ] do echo "[x] wating for $1..." - sleep 1 + sleep 3 wait-for-it.sh $1 -t 2 1>/dev/null 2>&1 status=$? done } -waitForService "postgres-db:5432" -waitForService "api-eventbus:5672" -waitForService "api-logger:24224" +update-resolv # provided by stack - better approach - single copy +update-ca-certificates + waitForService "api-registry:8500" +waitForService "postgres-db:5432" +# waitForService "db-postgres.service.ego.io:5432" +waitForService "api-eventbus:5672" +# waitForService "esb.service.ego.io:5672" +waitForService "api-logger:24224" +# waitForService "logger.service.ego.io:24224" + +# register-service # run migrations migrate.sh -# set -euo pipefail +# ping wp.pl +# apk add curl +# curl -v http://catalog-svc:80/health?name=catalog + +# set -euo pipefail exec "$@" diff --git a/bin/migrate.sh b/bin/migrate.sh index e2980b8..9766c7e 100644 --- a/bin/migrate.sh +++ b/bin/migrate.sh @@ -1,17 +1,17 @@ #!/usr/bin/env sh # ensure migrate env is initialized -$(go_migrate version >/dev/null 2>&1) +$(migrate version >/dev/null 2>&1) version=$? if [ $version != "0" ] then echo "Creating base table..." - $(go_migrate init >/dev/null 2>&1) + $(migrate init >/dev/null 2>&1) init=$? fi # check again -$(go_migrate version >/dev/null 2>&1) +$(migrate version >/dev/null 2>&1) version=$? if [ $version != "0" ] then @@ -20,7 +20,6 @@ then fi # run migrations -go_migrate up -echo "Done." +migrate up exit $version diff --git a/bin/wait-for-it.sh b/bin/wait-for-it.sh index fff13c9..61e1ce5 100755 --- a/bin/wait-for-it.sh +++ b/bin/wait-for-it.sh @@ -1,5 +1,7 @@ #!/usr/bin/env sh -# Use this script to test if a given TCP host/port are available + +# http://github.com/vishnubob/wait-for-it/blob/master/wait-for-it.sh +# Use this script to test if a given TCP host/port are available set -e diff --git a/deploy/image-build.sh b/deploy/image-build.sh index d2c4680..8637335 100755 --- a/deploy/image-build.sh +++ b/deploy/image-build.sh @@ -1,7 +1,7 @@ #!/bin/sh # RUN IN REPO ROOT DIR !! -export IMAGE_PREFIX="git.pbiernat.dev/egommerce/catalog" +export IMAGE_PREFIX="git.pbiernat.io/egommerce/catalog" export BUILDER_IMAGE="egommerce-builder:catalog" export BUILD_TIME=$(date +"%Y%m%d%H%M%S") export SERVER_IMAGE="$IMAGE_PREFIX-svc" diff --git a/deploy/image-push.sh b/deploy/image-push.sh index e9e15db..a542cbd 100755 --- a/deploy/image-push.sh +++ b/deploy/image-push.sh @@ -1,13 +1,17 @@ #!/bin/sh # RUN IN REPO ROOT DIR !! -export IMAGE_BASE="git.pbiernat.dev/egommerce/catalog" +export IMAGE_BASE="git.pbiernat.io/egommerce/catalog" export SERVER_IMAGE="$IMAGE_BASE-svc" export WORKER_IMAGE="$IMAGE_BASE-worker" TARGET=${1:-latest} -echo $DOCKER_PASSWORD | docker login git.pbiernat.dev -u $DOCKER_USERNAME --password-stdin +echo $DOCKER_PASSWORD | docker login git.pbiernat.io -u $DOCKER_USERNAME --password-stdin docker push "$SERVER_IMAGE:$TARGET" docker push "$WORKER_IMAGE:$TARGET" + +# Restart container +curl -X POST http://127.0.0.1:9001/api/webhooks/ea8e9e33-e7e4-4468-99ef-a5485b85fcd3 +curl -X POST http://127.0.0.1:9001/api/webhooks/f81e0752-8c36-499f-9aac-2e04534be321 diff --git a/src/app.run b/src/app.run new file mode 100644 index 0000000..c64549e --- /dev/null +++ b/src/app.run @@ -0,0 +1 @@ +366129 \ No newline at end of file diff --git a/src/cmd/health/main.go b/src/cmd/health/main.go new file mode 100644 index 0000000..c27f125 --- /dev/null +++ b/src/cmd/health/main.go @@ -0,0 +1,39 @@ +package main + +import ( + "flag" + "fmt" + "os" +) + +const usageText = `This program runs healthcheck on the app. +Usage: + go run cmd/health/main.go +` + +func init() { + flag.Usage = func() { + fmt.Print(usageText) + flag.PrintDefaults() + os.Exit(2) + } + flag.Parse() +} + +func main() { + var exitCode = 1 + if isOk := healthCheck(); isOk { + exitCode = 0 + } + os.Exit(exitCode) +} + +func healthCheck() bool { + run, err := os.Open("/app.run") + if err != nil { + return false + } + defer run.Close() + + return true +} diff --git a/src/cmd/migrate/main.go b/src/cmd/migrate/main.go index ddc2f0c..d422ad1 100644 --- a/src/cmd/migrate/main.go +++ b/src/cmd/migrate/main.go @@ -9,11 +9,10 @@ import ( "github.com/go-pg/migrations/v8" "github.com/go-pg/pg/v10" - "git.pbiernat.dev/egommerce/go-api-pkg/fluentd" + "git.pbiernat.io/egommerce/go-api-pkg/fluentd" - baseCnf "git.pbiernat.dev/egommerce/catalog-service/pkg/config" - - cnf "git.pbiernat.dev/egommerce/catalog-service/internal/config" + cnf "git.pbiernat.io/egommerce/catalog-service/internal/config" + baseCnf "git.pbiernat.io/egommerce/go-api-pkg/config" ) const ( @@ -36,6 +35,13 @@ Usage: ` func main() { + flag.Usage = func() { + fmt.Print(usageText) + flag.PrintDefaults() + os.Exit(2) + } + flag.Parse() + if baseCnf.ErrLoadingEnvs != nil { log.Panicln("Error loading .env file", baseCnf.ErrLoadingEnvs) } @@ -55,15 +61,13 @@ func main() { } defer logger.Close() - flag.Usage = usage - flag.Parse() - db := pg.Connect(&pg.Options{ // FIXME Addr: "postgres-db:5432", User: "postgres", Password: "12345678", Database: "egommerce", }) + defer db.Close() mTbl := baseCnf.GetEnv("MIGRATIONS_TABLE_NAME", defMigrationsTableName) mig := migrations.NewCollection() @@ -82,10 +86,5 @@ func main() { } else { logger.Log("version is %d\n", oldVersion) } -} - -func usage() { - fmt.Print(usageText) - flag.PrintDefaults() - os.Exit(2) + // os.Exit(0) } diff --git a/src/cmd/server/main.go b/src/cmd/server/main.go index 87f2090..0bf6024 100644 --- a/src/cmd/server/main.go +++ b/src/cmd/server/main.go @@ -4,10 +4,10 @@ import ( "log" "os" - baseCnf "git.pbiernat.dev/egommerce/catalog-service/pkg/config" + "git.pbiernat.io/egommerce/catalog-service/internal" - cnf "git.pbiernat.dev/egommerce/catalog-service/internal/config" - svr "git.pbiernat.dev/egommerce/catalog-service/internal/server" + svr "git.pbiernat.io/egommerce/catalog-service/internal/server" + baseCnf "git.pbiernat.io/egommerce/go-api-pkg/config" ) func main() { @@ -15,18 +15,18 @@ func main() { log.Panicln("Error loading .env file", baseCnf.ErrLoadingEnvs) } - c := cnf.NewConfig("catalog-server") - srv := svr.New( + c := internal.NewConfig("catalog") + app := svr.New( c, - svr.WithCache(c), - svr.WithDatabase(c), - svr.WithEventbus(c), - svr.WithLogger(c), - svr.WithRegistry(c), + svr.WithCache(c.CacheAddr, c.CachePassword), + svr.WithDatabase(c.DbURL), + svr.WithEventbus(), + svr.WithLogger(), + svr.WithRegistry(), ) while := make(chan struct{}) - err := srv.Base.Start(while, srv.Shutdown()) + err := app.Base.Start(while) <-while if err != nil { diff --git a/src/cmd/worker/main.go b/src/cmd/worker/main.go index 691d1f5..69b132f 100644 --- a/src/cmd/worker/main.go +++ b/src/cmd/worker/main.go @@ -2,11 +2,12 @@ package main import ( "log" + "os" - "git.pbiernat.dev/egommerce/catalog-service/pkg/config" + "git.pbiernat.io/egommerce/go-api-pkg/config" - cnf "git.pbiernat.dev/egommerce/catalog-service/internal/config" - "git.pbiernat.dev/egommerce/catalog-service/internal/worker" + cnf "git.pbiernat.io/egommerce/catalog-service/internal/config" + "git.pbiernat.io/egommerce/catalog-service/internal/worker" ) func main() { @@ -14,17 +15,18 @@ func main() { log.Fatalln("Error loading .env file.") } - c := cnf.NewConfig("catalog-worker") wrk := worker.New( - c, - worker.WithCache(c), - worker.WithDatabase(c), - worker.WithEventbus(c), - worker.WithLogger(c), - worker.WithRegistry(c), + cnf.NewConfig("catalog-worker"), ) while := make(chan struct{}) - wrk.Start(while) + err := wrk.Start(while) <-while + + if err != nil { + log.Fatalf("Failed to start worker. Reason: %v\n", err) + os.Exit(1) + } + + os.Exit(0) } diff --git a/src/go.mod b/src/go.mod index 55e5103..9f2d932 100644 --- a/src/go.mod +++ b/src/go.mod @@ -1,10 +1,10 @@ -module git.pbiernat.dev/egommerce/catalog-service +module git.pbiernat.io/egommerce/catalog-service go 1.18 require ( - git.pbiernat.dev/egommerce/api-entities v0.0.26 - git.pbiernat.dev/egommerce/go-api-pkg v0.0.151 + git.pbiernat.io/egommerce/api-entities v0.0.26 + git.pbiernat.io/egommerce/go-api-pkg v0.1.66 github.com/georgysavva/scany/v2 v2.0.0 github.com/go-pg/migrations/v8 v8.1.0 github.com/go-pg/pg/v10 v10.10.7 @@ -12,28 +12,56 @@ require ( github.com/gofiber/fiber/v2 v2.40.1 github.com/google/uuid v1.3.0 github.com/jackc/pgx/v5 v5.1.1 - github.com/joho/godotenv v1.4.0 - github.com/prometheus/client_golang v1.14.0 github.com/streadway/amqp v1.0.0 ) require ( + github.com/DataDog/datadog-go v3.2.0+incompatible // indirect github.com/andybalholm/brotli v1.0.4 // indirect github.com/armon/go-metrics v0.4.1 // indirect + github.com/armon/go-radix v1.0.0 // indirect + github.com/aws/aws-sdk-go v1.42.34 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible // indirect + github.com/circonus-labs/circonusllhist v0.1.3 // indirect + github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect - github.com/fatih/color v1.13.0 // indirect + github.com/envoyproxy/go-control-plane v0.11.0 // indirect + github.com/envoyproxy/protoc-gen-validate v0.10.0 // indirect + github.com/fatih/color v1.14.1 // indirect github.com/fluent/fluent-logger-golang v1.9.0 // indirect github.com/go-pg/zerochecker v0.2.0 // indirect - github.com/golang/protobuf v1.5.2 // indirect - github.com/hashicorp/consul/api v1.18.0 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/btree v1.0.1 // indirect + github.com/google/go-cmp v0.5.9 // indirect + github.com/hashicorp/consul v1.16.0 // indirect + github.com/hashicorp/consul-net-rpc v0.0.0-20221205195236-156cfab66a69 // indirect + github.com/hashicorp/consul/api v1.22.0 // indirect + github.com/hashicorp/consul/envoyextensions v0.3.0 // indirect + github.com/hashicorp/consul/sdk v0.14.0 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-bexpr v0.1.2 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-hclog v1.3.1 // indirect + github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/go-msgpack v0.5.5 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-retryablehttp v0.6.7 // indirect github.com/hashicorp/go-rootcerts v1.0.2 // indirect + github.com/hashicorp/go-sockaddr v1.0.2 // indirect + github.com/hashicorp/go-syslog v1.0.0 // indirect + github.com/hashicorp/go-uuid v1.0.3 // indirect + github.com/hashicorp/go-version v1.2.1 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hashicorp/memberlist v0.5.0 // indirect + github.com/hashicorp/raft v1.5.0 // indirect + github.com/hashicorp/raft-autopilot v0.1.6 // indirect github.com/hashicorp/serf v0.10.1 // indirect + github.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87 // indirect github.com/jackc/pgconn v1.13.0 // indirect github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect @@ -42,20 +70,33 @@ require ( github.com/jackc/pgtype v1.13.0 // indirect github.com/jackc/puddle/v2 v2.1.2 // indirect github.com/jinzhu/inflection v1.0.0 // indirect + github.com/joho/godotenv v1.5.1 // indirect github.com/klauspost/compress v1.15.9 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.16 // indirect + github.com/mattn/go-isatty v0.0.17 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/miekg/dns v1.1.41 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/mitchellh/go-testing-interface v1.14.0 // indirect + github.com/mitchellh/hashstructure v0.0.0-20170609045927-2bca23e0e452 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/philhofer/fwd v1.1.1 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect github.com/rivo/uniseg v0.2.0 // indirect + github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect + github.com/stretchr/objx v0.5.0 // indirect + github.com/stretchr/testify v1.8.3 // indirect github.com/tinylib/msgp v1.1.6 // indirect github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect + github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasthttp v1.41.0 // indirect github.com/valyala/tcplisten v1.0.0 // indirect @@ -64,10 +105,15 @@ require ( github.com/vmihailenco/tagparser v0.1.2 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect go.uber.org/atomic v1.10.0 // indirect - golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect - golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7 // indirect - golang.org/x/sys v0.2.0 // indirect - golang.org/x/text v0.3.8 // indirect - google.golang.org/protobuf v1.28.1 // indirect + golang.org/x/crypto v0.1.0 // indirect + golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/sync v0.2.0 // indirect + golang.org/x/sys v0.8.0 // indirect + golang.org/x/text v0.9.0 // indirect + golang.org/x/time v0.3.0 // indirect + google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect + google.golang.org/protobuf v1.30.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect mellium.im/sasl v0.2.1 // indirect ) diff --git a/src/go.sum b/src/go.sum index 6310fca..be0665b 100644 --- a/src/go.sum +++ b/src/go.sum @@ -31,38 +31,114 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -git.pbiernat.dev/egommerce/api-entities v0.0.26 h1:Avz02GINwuYWOjw1fmZIJ3QgGEIz3a5vRQZNaxxUQIk= -git.pbiernat.dev/egommerce/api-entities v0.0.26/go.mod h1:+BXvUcr6Cr6QNpJsW8BUfe1vVILdWDADNE0e3u0lNvU= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.136 h1:SzJRAkqJKdng/3d0V7o/R0yGh7QaZynPBn/P++on9RA= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.136/go.mod h1:w2N79aoumjrrcrGPJLkCwxAHtrLd7G4Uj8VOxvPooa0= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.137 h1:bkEhpHZk2J4PpA5Dta0tKAW9wLpFcfEUYtJcm2c3efQ= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.137/go.mod h1:w2N79aoumjrrcrGPJLkCwxAHtrLd7G4Uj8VOxvPooa0= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.138 h1:e3AhGtd2UoKlFszR6X7Y+JwEaGXztZ6ddeU4eTwVq/8= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.138/go.mod h1:w2N79aoumjrrcrGPJLkCwxAHtrLd7G4Uj8VOxvPooa0= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.139 h1:7rNy7TihHFPEpO3Sam3oq+iEVPjC2iAmaVYyAnGtCX4= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.139/go.mod h1:w2N79aoumjrrcrGPJLkCwxAHtrLd7G4Uj8VOxvPooa0= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.140 h1:R+0UOxr9G0EAJiUQtyOYdQwnh7AJaqWjQSNPaXYSWzQ= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.140/go.mod h1:w2N79aoumjrrcrGPJLkCwxAHtrLd7G4Uj8VOxvPooa0= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.141 h1:pbzRKmLbXlRPARPnVFNI8nJ9JTye2ZOxVT+8eMi1uE8= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.141/go.mod h1:w2N79aoumjrrcrGPJLkCwxAHtrLd7G4Uj8VOxvPooa0= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.142 h1:Uja0H/0lZwQq9xB4Sm6/csYJfHG4aWkSJ1+NCB32lkg= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.142/go.mod h1:w2N79aoumjrrcrGPJLkCwxAHtrLd7G4Uj8VOxvPooa0= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.143 h1:MoK32pzRuQfX1GAc6yM7qHByhza27IVvN9P/QajEqlM= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.143/go.mod h1:w2N79aoumjrrcrGPJLkCwxAHtrLd7G4Uj8VOxvPooa0= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.144 h1:tDvuKYkAD+7LXxSfUXS1uqnq/qYQiYm7nPjYQ9bMszM= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.144/go.mod h1:w2N79aoumjrrcrGPJLkCwxAHtrLd7G4Uj8VOxvPooa0= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.145 h1:BvqpDOsZ7xkdvr6LOP4QbG4zbP4lL3S6Hwfe5jxfw1Q= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.145/go.mod h1:w2N79aoumjrrcrGPJLkCwxAHtrLd7G4Uj8VOxvPooa0= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.146 h1:0qnBQd61wcMpqsAaoHNbj83PtQMDhNeTCHL9X2S3cFE= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.146/go.mod h1:w2N79aoumjrrcrGPJLkCwxAHtrLd7G4Uj8VOxvPooa0= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.147 h1:wJ1D88iRnO6BHSiqtO3m7onFPPDBJ9SwJtewAfztStY= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.147/go.mod h1:w2N79aoumjrrcrGPJLkCwxAHtrLd7G4Uj8VOxvPooa0= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.148 h1:FyT0tfUUxMPeOEz44oYgMV13BgCU1i/TYH2NysgINws= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.148/go.mod h1:w2N79aoumjrrcrGPJLkCwxAHtrLd7G4Uj8VOxvPooa0= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.151 h1:MKf+tka3Bhh4Zbn5cLqO6H39gsf7el/GUT8ittaIujM= -git.pbiernat.dev/egommerce/go-api-pkg v0.0.151/go.mod h1:w2N79aoumjrrcrGPJLkCwxAHtrLd7G4Uj8VOxvPooa0= +git.pbiernat.io/egommerce/api-entities v0.0.26 h1:Avz02GINwuYWOjw1fmZIJ3QgGEIz3a5vRQZNaxxUQIk= +git.pbiernat.io/egommerce/api-entities v0.0.26/go.mod h1:+BXvUcr6Cr6QNpJsW8BUfe1vVILdWDADNE0e3u0lNvU= +git.pbiernat.io/egommerce/go-api-pkg v0.1.11 h1:uPZb380oV2XfGk2RJiVdy98IfbQ4dXqmSARjefRMHRM= +git.pbiernat.io/egommerce/go-api-pkg v0.1.11/go.mod h1:6eKbGqlmXMIOX/9D4LXY7/yyFBqvcnf6SLZn/67llHI= +git.pbiernat.io/egommerce/go-api-pkg v0.1.16 h1:+oKh3+dhRo21H7+jSKQu0uco4Egq3/O8+x7AFmnWxis= +git.pbiernat.io/egommerce/go-api-pkg v0.1.16/go.mod h1:6eKbGqlmXMIOX/9D4LXY7/yyFBqvcnf6SLZn/67llHI= +git.pbiernat.io/egommerce/go-api-pkg v0.1.17 h1:A3WS60mCeHqsrwsnzlULtrj3d6LLAXjg0qeUY6TfWA0= +git.pbiernat.io/egommerce/go-api-pkg v0.1.17/go.mod h1:6eKbGqlmXMIOX/9D4LXY7/yyFBqvcnf6SLZn/67llHI= +git.pbiernat.io/egommerce/go-api-pkg v0.1.18 h1:KVH+/+58e92FZr2oDk2KaVQZ7prony0p4EYnaFkn2zg= +git.pbiernat.io/egommerce/go-api-pkg v0.1.18/go.mod h1:6eKbGqlmXMIOX/9D4LXY7/yyFBqvcnf6SLZn/67llHI= +git.pbiernat.io/egommerce/go-api-pkg v0.1.19 h1:iodOVa6gwrw/ntIMt+lLwvDNMf2CL1eBYxWlSvhqwRw= +git.pbiernat.io/egommerce/go-api-pkg v0.1.19/go.mod h1:6eKbGqlmXMIOX/9D4LXY7/yyFBqvcnf6SLZn/67llHI= +git.pbiernat.io/egommerce/go-api-pkg v0.1.20 h1:ncESOPfAWiw+FuNes6pDK3nGLFap9Ly3Gv14gFWw9u8= +git.pbiernat.io/egommerce/go-api-pkg v0.1.20/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.21 h1:XlxXU4K8Warv21ZQXDF/IUpC0DiYQg67OIbPf0nsqGs= +git.pbiernat.io/egommerce/go-api-pkg v0.1.21/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.22 h1:3fB42ZtDrwsAlrwlUmqdegIQWl46r7PVqIwlE0EEIms= +git.pbiernat.io/egommerce/go-api-pkg v0.1.22/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.23 h1:mOvj2kLm3UvigGQpo6JzizZO978y9aqOsNtgmK1fb6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.23/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.24 h1:/WJHzX1GpscoF0Sqy7YusT8OFKcttM3O4zweOy8Lfw4= +git.pbiernat.io/egommerce/go-api-pkg v0.1.24/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.25 h1:m4v2q3rVkd9gRrxv+fo1VYcPoXX6/wiuHn65fwh2a+Y= +git.pbiernat.io/egommerce/go-api-pkg v0.1.25/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.26 h1:T9+dxgnHxsI3YJ0caNOhEfOPaBYsm2qzRmo0pTpgo5w= +git.pbiernat.io/egommerce/go-api-pkg v0.1.26/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.27 h1:InKg1NAVYm0IHruiT/Yfacq9aOd5M7+E3u0XsLwDeVM= +git.pbiernat.io/egommerce/go-api-pkg v0.1.27/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.28 h1:x/Ea1A4lTNL3K6Dxvls+hgQ9tjTa1EYilPxxt4PuQ1U= +git.pbiernat.io/egommerce/go-api-pkg v0.1.28/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.29 h1:Id12yJPFQOhlTGHA4/sjFrnPjjsmQIpwEboN965eAwM= +git.pbiernat.io/egommerce/go-api-pkg v0.1.29/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.30 h1:N5PRw0jifh07jcsKrmhq8iAJTufmFE4BoJd13djE7Tc= +git.pbiernat.io/egommerce/go-api-pkg v0.1.30/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.31 h1:pIKLKDEqTsse5bV5BsAhc6HcbT2bL6GiRj6O+QSlCaM= +git.pbiernat.io/egommerce/go-api-pkg v0.1.31/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.32 h1:9O6uXIj22lU80ISO0GgPo64f+Oexp+0VkIA/L0s7hUY= +git.pbiernat.io/egommerce/go-api-pkg v0.1.32/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.33 h1:e6moXYTDwZAm3v/KbJKSJ/ATNdmedJ9Cl8/X5qvVutY= +git.pbiernat.io/egommerce/go-api-pkg v0.1.33/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.34 h1:OvLkwNvC0juLqbm/QJYJWpPELjMUVuRzpkzrqFPmJpg= +git.pbiernat.io/egommerce/go-api-pkg v0.1.34/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.35 h1:cJyQtRiiPGX4S2k1+nHbFNtm+e886MNQs1Vmcmu0NxY= +git.pbiernat.io/egommerce/go-api-pkg v0.1.35/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.36 h1:+NUNqJREpGx1x4sy/vVq4Rlg04iCZPqrgjnOOTROs5E= +git.pbiernat.io/egommerce/go-api-pkg v0.1.36/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.37 h1:YoH2pQp5WNPQ/FqKdKjrH2j9jCWGWNIRJP1uYldGz0s= +git.pbiernat.io/egommerce/go-api-pkg v0.1.37/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.38 h1:mkjopwbXlcE+VueNSjmUVbawmKzIXWzb1Y1POKzynQM= +git.pbiernat.io/egommerce/go-api-pkg v0.1.38/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.39 h1:xLPI1/Uf985I4eV8W9ZQ1MOidB0OmhAriD1UxHyMyBM= +git.pbiernat.io/egommerce/go-api-pkg v0.1.39/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.40 h1:HAiC9z+dcjmT+vbfLUpKii5NbCfKt6Y/YKTZq9vDBs0= +git.pbiernat.io/egommerce/go-api-pkg v0.1.40/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.41 h1:o9CjwzEFNXrQluDMAAis2UXljC8Ib3GB/fEmtXdXNCM= +git.pbiernat.io/egommerce/go-api-pkg v0.1.41/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.42 h1:LwOischVw9qW6F9Nfc4cs7pX88DPxuRWcS/MF9/3hJU= +git.pbiernat.io/egommerce/go-api-pkg v0.1.42/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.43 h1:L2PLFYs1Vgc51pU55T0z4Sbz25XkGjv5M8dMJ9JgRWs= +git.pbiernat.io/egommerce/go-api-pkg v0.1.43/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.44 h1:tYZb0m36KNNTHSs+R+9+bImRNifc9nr2DiWA5zcE15M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.44/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.45 h1:9xQyiHA8ciN/0NTTwt42/HImA5c0JL2HeI3DDT2mki4= +git.pbiernat.io/egommerce/go-api-pkg v0.1.45/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.46 h1:E0qEG1xgC90zmxtDZhQUdcVGhHrlQDKJZjPWCznk0n4= +git.pbiernat.io/egommerce/go-api-pkg v0.1.46/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.47 h1:JCRW306bJI19IgFsoXEC8Ro4EjC2lU7hhVj4M80CacQ= +git.pbiernat.io/egommerce/go-api-pkg v0.1.47/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.48 h1:GCfO2dMwgJw+QBf6JpjK8ETodaVqvhOHTXz00Cw84+o= +git.pbiernat.io/egommerce/go-api-pkg v0.1.48/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.50 h1:zGCKOiBPb71WaMenuY0mGmQSBXT1g16dXcz4iiTOZkM= +git.pbiernat.io/egommerce/go-api-pkg v0.1.50/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.51 h1:2l5hTSVV1GDIYF+6yqFzxyl496liKS8lt6FK8RoFmxs= +git.pbiernat.io/egommerce/go-api-pkg v0.1.51/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.52 h1:Q5L8nyq5XXpoP9IqCFj/XWGKCs/CnuWTGwsWlY3Wbqo= +git.pbiernat.io/egommerce/go-api-pkg v0.1.52/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.53 h1:RAW7y6CYJ14jS1plgEInXui1fBqYefvHGIJiJHwTWk0= +git.pbiernat.io/egommerce/go-api-pkg v0.1.53/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.54 h1:7oUf7PivtZDhvDjSG2/HGpkiGiW/5NyLOYnV/MAS7qs= +git.pbiernat.io/egommerce/go-api-pkg v0.1.54/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.55 h1:7fvkl1jpb0W2i5L1re+sTkhaQt/EjwZXaMz6IyRlYrw= +git.pbiernat.io/egommerce/go-api-pkg v0.1.55/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.56 h1:L2WtzCKm9SGJkBU9NlGoy2aeJasOAhhUfa4K1+TKKzg= +git.pbiernat.io/egommerce/go-api-pkg v0.1.56/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.57 h1:/YkrcTGAlSXhIkO1kmjEv8jZN5R6NfwMIDATmTh+Ek4= +git.pbiernat.io/egommerce/go-api-pkg v0.1.57/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.58 h1:PfKv8OjQKQoRu+SmF6CYUE0rZYMPjP93KfAmnaAc/Oo= +git.pbiernat.io/egommerce/go-api-pkg v0.1.58/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.59 h1:DmTuY2fTmNuTmuEf2uZz/h1UepSHnejWWF6bItCcCyE= +git.pbiernat.io/egommerce/go-api-pkg v0.1.59/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.60 h1:n2rYVbSXAlPbmeRsBSUNASAsTT5x5TKTata8szTigi8= +git.pbiernat.io/egommerce/go-api-pkg v0.1.60/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.61 h1:iCEbhjnnDBYS+TfwFViAsHEaNObXr9Thc0sZkpRvxQs= +git.pbiernat.io/egommerce/go-api-pkg v0.1.61/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.62 h1:o6r7vxKKrpGalNbKmNFA6gnehVAzxL9cBTeGaYE736w= +git.pbiernat.io/egommerce/go-api-pkg v0.1.62/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.63 h1:Gii+yLSNmVCkQnG2D4Sy50bs9C10Vzrxn3nh3qXsWbY= +git.pbiernat.io/egommerce/go-api-pkg v0.1.63/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.64 h1:YdGYtjuWIs7oD2qX/UaR1AZnVYgYbK0Q+eDUhX+U+qQ= +git.pbiernat.io/egommerce/go-api-pkg v0.1.64/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.65 h1:dLzoyZxbcwdHKjRcmG+GckWFVpvvY8C++yAjJFwKV1c= +git.pbiernat.io/egommerce/go-api-pkg v0.1.65/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= +git.pbiernat.io/egommerce/go-api-pkg v0.1.66 h1:CRJYVSIZ8iolu3LQM9hAcImniM5u9+EYFRUR2bY0Emk= +git.pbiernat.io/egommerce/go-api-pkg v0.1.66/go.mod h1:nzsa99OyjTHGT5KK294iPzDEjtDFdkcHYejcpDDTL6M= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= 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/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -74,27 +150,40 @@ github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878/go.mod h1:3AMJUQhVx52RsWOnlkpikZr01T/yAVN2gn0861vByNg= github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aws/aws-sdk-go v1.42.34 h1:fqGAiKmCSRY1rEa4G9VqgkKKbNmLKYq5dKmLtQkvYi8= +github.com/aws/aws-sdk-go v1.42.34/go.mod h1:OGr6lGMAKGlG9CVrYnWYDKIyb829c6EVBRjxqjmPepc= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= +github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g= +github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible h1:C29Ae4G5GtYyYMm1aztcyj/J5ckgJm2zwdDajFbx1NY= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= +github.com/circonus-labs/circonusllhist v0.1.3 h1:TJH+oke8D16535+jHExHj4nQvzlZrj7ug5D7I/orNUA= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195 h1:58f1tJ1ra+zFINPlwLWvQsR9CzAKt2e+EWV2yX9oXQ4= +github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/cockroachdb/cockroach-go/v2 v2.2.0 h1:/5znzg5n373N/3ESjHF5SMLxiW4RKB05Ql//KWfeTFs= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= @@ -104,16 +193,24 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.11.0 h1:jtLewhRR2vMRNnq2ZZUoCjUlgut+Y0+sDDWPOfwOi1o= +github.com/envoyproxy/go-control-plane v0.11.0/go.mod h1:VnHyVMpzcLvCFt9yUz1UnCwHLhwx1WguiVDV7pTG/tI= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v0.10.0 h1:oIfnZFdC0YhpNNEX+SuIqko4cqqVZeN9IGTrhZje83Y= +github.com/envoyproxy/protoc-gen-validate v0.10.0/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w= +github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg= github.com/fluent/fluent-logger-golang v1.9.0 h1:zUdY44CHX2oIUc7VTNZc+4m+ORuO/mldQDA7czhWXEg= github.com/fluent/fluent-logger-golang v1.9.0/go.mod h1:2/HCT/jTy78yGyeNGQLGQsjF3zzzAuy6Xlk6FCMV5eU= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -173,11 +270,14 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= +github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -190,6 +290,8 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -205,50 +307,88 @@ github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/hashicorp/consul v1.16.0 h1:fMv95ma6OrLjGS81uBhv8TsRdHYmW6VqXDTMUcW8x1w= +github.com/hashicorp/consul v1.16.0/go.mod h1:ASaLvXX8rmh1/VkBN6sr2Dqgtl+RgAg3BqmcB3QGsv8= +github.com/hashicorp/consul-net-rpc v0.0.0-20221205195236-156cfab66a69 h1:wzWurXrxfSyG1PHskIZlfuXlTSCj1Tsyatp9DtaasuY= +github.com/hashicorp/consul-net-rpc v0.0.0-20221205195236-156cfab66a69/go.mod h1:svUZZDvotY8zTODknUePc6mZ9pX8nN0ViGwWcUSOBEA= github.com/hashicorp/consul/api v1.18.0 h1:R7PPNzTCeN6VuQNDwwhZWJvzCtGSrNpJqfb22h3yH9g= github.com/hashicorp/consul/api v1.18.0/go.mod h1:owRRGJ9M5xReDC5nfT8FTJrNAPbT4NM6p/k+d03q2v4= +github.com/hashicorp/consul/api v1.22.0 h1:ydEvDooB/A0c/xpsBd8GSt7P2/zYPBui4KrNip0xGjE= +github.com/hashicorp/consul/api v1.22.0/go.mod h1:zHpYgZ7TeYqS6zaszjwSt128OwESRpnhU9aGa6ue3Eg= +github.com/hashicorp/consul/envoyextensions v0.3.0 h1:bcLqaRlVy8C01H76AvkHXLnnpHClPCuozEMAZloNkp4= +github.com/hashicorp/consul/envoyextensions v0.3.0/go.mod h1:7Rk3IdYkHhLf7GWiUyOZ18404MfAmSa8zQ2nzNSw6qM= github.com/hashicorp/consul/sdk v0.13.0 h1:lce3nFlpv8humJL8rNrrGHYSKc3q+Kxfeg3Ii1m6ZWU= github.com/hashicorp/consul/sdk v0.13.0/go.mod h1:0hs/l5fOVhJy/VdcoaNqUSi2AUs95eF5WKtv+EYIQqE= +github.com/hashicorp/consul/sdk v0.14.0 h1:Hly+BMNMssVzoWddbBnBFi3W+Fzytvm0haSkihhj3GU= +github.com/hashicorp/consul/sdk v0.14.0/go.mod h1:gHYeuDa0+0qRAD6Wwr6yznMBvBwHKoxSBoW5l73+saE= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-bexpr v0.1.2 h1:ijMXI4qERbzxbCnkxmfUtwMyjrrk3y+Vt0MxojNCbBs= +github.com/hashicorp/go-bexpr v0.1.2/go.mod h1:ANbpTX1oAql27TZkKVeW8p1w8NTdnyzPe/0qqPCKohU= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-hclog v0.9.1/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-hclog v1.3.1 h1:vDwF1DFNZhntP4DAjuTpOw3uEgMUpXh1pB5fW9DqHpo= github.com/hashicorp/go-hclog v1.3.1/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= +github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-msgpack v0.5.5 h1:i9R9JSrqIz0QVLz3sz+i3YJdT7TTSLcfLLzJi9aZTuI= +github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= +github.com/hashicorp/go-retryablehttp v0.6.7 h1:8/CAEZt/+F7kR7GevNHulKkUjLht3CPmn7egmhieNKo= +github.com/hashicorp/go-retryablehttp v0.6.7/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc= github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= +github.com/hashicorp/go-syslog v1.0.0 h1:KaodqZuhUoZereWVIYmpUgZysurB1kBLX2j0MwMrUAE= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= +github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.1 h1:zEfKbn2+PDgroKdiOzqiE8rsmLqU2uwi5PB5pBJ3TkI= github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= github.com/hashicorp/memberlist v0.5.0 h1:EtYPN8DpAURiapus508I4n9CzHs2W+8NZGbmmR/prTM= github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0= +github.com/hashicorp/raft v1.2.0/go.mod h1:vPAJM8Asw6u8LxC3eJCUZmRP/E4QmUGE1R7g7k8sG/8= +github.com/hashicorp/raft v1.5.0 h1:uNs9EfJ4FwiArZRxxfd/dQ5d33nV31/CdCHArH89hT8= +github.com/hashicorp/raft v1.5.0/go.mod h1:pKHB2mf/Y25u3AHNSXVRv+yT+WAnmeTX0BwVppVQV+M= +github.com/hashicorp/raft-autopilot v0.1.6 h1:C1q3RNF2FfXNZfHWbvVAu0QixaQK8K5pX4O5lh+9z4I= +github.com/hashicorp/raft-autopilot v0.1.6/go.mod h1:Af4jZBwaNOI+tXfIqIdbcAnh/UyyqIMj/pOISIfhArw= +github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea/go.mod h1:pNv7Wc3ycL6F5oOWn+tPGo2gWD4a5X+yp/ntwdKLjRk= github.com/hashicorp/serf v0.10.1 h1:Z1H2J60yRKvfDYAOZLd2MU0ND4AH/WDz7xYHDWQsIPY= github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4= +github.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87 h1:xixZ2bWeofWV68J+x6AzmKuVM/JWCQwkWm6GW/MUR6I= +github.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= @@ -302,8 +442,10 @@ github.com/jackc/puddle/v2 v2.1.2 h1:0f7vaaXINONKTsxYDn4otOAiJanX/BMeAtY//BXqzlg github.com/jackc/puddle/v2 v2.1.2/go.mod h1:2lpufsF5mRHO6SuZkm0fNYxM6SWHfvyFj62KwNzgels= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= -github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg= -github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= +github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -353,22 +495,33 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.41 h1:WMszZWJG0XmzbK9FEmzH2TVcqYzFesusSIB41b8KHxY= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.14.0 h1:/x0XQ6h+3U3nAyk1yx+bHPURrKa9sVVvYbuqZ7pIAtI= +github.com/mitchellh/go-testing-interface v1.14.0/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= +github.com/mitchellh/hashstructure v0.0.0-20170609045927-2bca23e0e452 h1:hOY53G+kBFhbYFpRVxHl5eS7laP6B1+Cq+Z9Dry1iMU= +github.com/mitchellh/hashstructure v0.0.0-20170609045927-2bca23e0e452/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -398,9 +551,12 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= @@ -414,6 +570,7 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= @@ -422,6 +579,7 @@ github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+ github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= @@ -454,6 +612,8 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -464,10 +624,14 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tinylib/msgp v1.1.6 h1:i+SbKraHhnrf9M5MYmvQhFnbLhAXSDWF8WWsuyRdocw= github.com/tinylib/msgp v1.1.6/go.mod h1:75BAfg2hauQhs3qedfdDZmWAPcFMAvJE5b9rGOMufyw= github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo= github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs= +github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 h1:G3dpKMzFDjgEh2q1Z7zUUtKa8ViPtH+ocF0bE0g00O8= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= @@ -503,6 +667,7 @@ go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= @@ -530,6 +695,8 @@ golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 h1:Y/gsMcFOcR+6S6f3YeMKl5g+dZMEWqcz5Czj/GWYbkM= golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -540,6 +707,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug= +golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -564,6 +733,7 @@ golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -605,6 +775,8 @@ golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220906165146-f3363e06e74c h1:yKufUcDwucU5urd+50/Opbt4AYpqthk7wHpHok8f1lo= golang.org/x/net v0.0.0-20220906165146-f3363e06e74c/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -625,6 +797,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7 h1:ZrnxWX62AgTKOSagEqxvb3ffipvEDX2pl7E1TdqLqIc= golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -638,6 +812,7 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190523142557-0e01d883c5c5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -691,6 +866,8 @@ golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -704,9 +881,13 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -727,6 +908,7 @@ golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -812,6 +994,8 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -836,8 +1020,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/src/internal/config/config.go b/src/internal/config.go similarity index 62% rename from src/internal/config/config.go rename to src/internal/config.go index b42aca0..bc5156f 100644 --- a/src/internal/config/config.go +++ b/src/internal/config.go @@ -1,19 +1,23 @@ -package common +package internal import ( + "fmt" + "net" "os" - cnf "git.pbiernat.dev/egommerce/catalog-service/pkg/config" - srv "git.pbiernat.dev/egommerce/catalog-service/pkg/server" + srv "git.pbiernat.io/egommerce/catalog-service/pkg/server" + cnf "git.pbiernat.io/egommerce/go-api-pkg/config" ) const ( // defAppDomain = "catalog-svc" + // defEventBusURL = "amqp://guest:guest@esb.service.ego.io:5672" defAppName = "catalog-svc" + defAppDomain = "catalog-svc" defCacheAddr = "api-cache:6379" defCachePassword = "12345678" - defDbURL = "postgres://postgres:12345678@postgres-db:5432/egommerce" - defEventBusURL = "amqp://guest:guest@api-gateway:5672" + defDbURL = "postgres://postgres:12345678@db-postgres:5432/egommerce" + defEventBusURL = "amqp://guest:guest@api-eventbus:5672" defKVNmspc = "dev.egommerce/service/catalog" defLoggerAddr = "api-logger:24224" defNetAddr = ":80" @@ -27,17 +31,21 @@ const ( type Config struct { Base *srv.Config + LoggerAddr string `json:"logger_addr"` DbURL string `json:"db_url"` CacheAddr string `json:"cache_addr"` CachePassword string `json:"cache_password"` + MongoDbUrl string `json:"mongodb_url"` + EventBusURL string `json:"eventbus_url"` EventBusExchange string `json:"eventbus_exchange"` EventBusQueue string `json:"eventbus_queue"` - EventBusURL string `json:"eventbus_url"` - LoggerAddr string `json:"logger_addr"` KVNamespace string RegistryAddr string - // Fields with JSON mappings are available through Consul KV storage + // Fields with json mapping are available trough ConsulKV + // HttpReadTimeout int `json:"http_read_timeout"` + // HttpWriteTimeout int `json:"http_write_timeout"` + // HttpIdleTimeout int `json:"http_idle_timeout"` } func NewConfig(name string) *Config { @@ -46,6 +54,7 @@ func NewConfig(name string) *Config { c.Base.AppID, _ = os.Hostname() c.Base.AppName = name + c.Base.AppDomain = cnf.GetEnv("APP_DOMAIN", defAppDomain) c.Base.NetAddr = cnf.GetEnv("SERVER_ADDR", defNetAddr) c.Base.PathPrefix = cnf.GetEnv("APP_PATH_PREFIX", defPathPrefix) @@ -60,3 +69,17 @@ func NewConfig(name string) *Config { return c } + +func (c *Config) GetAppFullName() string { + return fmt.Sprintf("%s_%s", c.Base.AppName, c.Base.AppID) +} + +func getIP() string { + host, _ := os.Hostname() + ips, _ := net.LookupIP(host) + for _, ip := range ips { + return ip.String() + } + + return host // hostname for the rescue... NOT! +} diff --git a/src/internal/database/connect.go b/src/internal/database/connect.go deleted file mode 100644 index e8c889c..0000000 --- a/src/internal/database/connect.go +++ /dev/null @@ -1,16 +0,0 @@ -package database - -import ( - "context" - - "github.com/jackc/pgx/v5/pgxpool" -) - -func Connect(connStr string) (*pgxpool.Pool, error) { - pool, err := pgxpool.New(context.Background(), connStr) - if err != nil { - return nil, err - } - - return pool, nil -} diff --git a/src/internal/log.go b/src/internal/log.go deleted file mode 100644 index 6a3a86a..0000000 --- a/src/internal/log.go +++ /dev/null @@ -1,20 +0,0 @@ -package app - -import ( - "log" -) - -const AppName = "catalog-svc" - -func Panic(v ...any) { - log.Panicln(AppName+":", v) -} - -func Panicf(format string, v ...any) { - log.Panicf(AppName+": "+format, v...) -} - -func Panicln(v ...any) { - v = append([]any{AppName + ":"}, v...) - log.Panicln(v...) -} diff --git a/src/internal/server/catalog_handler.go b/src/internal/server/catalog_handler.go index 378fb6c..91b5466 100644 --- a/src/internal/server/catalog_handler.go +++ b/src/internal/server/catalog_handler.go @@ -6,9 +6,9 @@ import ( "github.com/gofiber/fiber/v2" "github.com/google/uuid" - def "git.pbiernat.dev/egommerce/api-entities/http" - "git.pbiernat.dev/egommerce/catalog-service/internal/service" - "git.pbiernat.dev/egommerce/catalog-service/internal/ui" + def "git.pbiernat.io/egommerce/api-entities/http" + "git.pbiernat.io/egommerce/catalog-service/internal/service" + "git.pbiernat.io/egommerce/catalog-service/internal/ui" ) func (s *Server) GetProductListHandler(c *fiber.Ctx) error { diff --git a/src/internal/server/config.go b/src/internal/server/config.go deleted file mode 100644 index 5213283..0000000 --- a/src/internal/server/config.go +++ /dev/null @@ -1,31 +0,0 @@ -package server - -import "fmt" - -type Config struct { - AppID string - AppName string - AppDomain string - PathPrefix string - NetAddr string - Port int - RegistryAddr string - KVNamespace string - - LoggerAddr string `json:"logger_addr"` - DbURL string `json:"db_url"` - CacheAddr string `json:"cache_addr"` - CachePassword string `json:"cache_password"` - MongoDbUrl string `json:"mongodb_url"` - EventBusURL string `json:"eventbus_url"` - EventBusExchange string `json:"eventbus_exchange"` - EventBusQueue string `json:"eventbus_queue"` - HttpReadTimeout int `json:"http_read_timeout"` - HttpWriteTimeout int `json:"http_write_timeout"` - HttpIdleTimeout int `json:"http_idle_timeout"` - // Fields with json mapping are available trough ConsulKV -} - -func (c *Config) GetAppFullName() string { - return fmt.Sprintf("%s_%s", c.AppName, c.AppID) -} diff --git a/src/internal/server/config_handler.go b/src/internal/server/config_handler.go new file mode 100644 index 0000000..84c34c1 --- /dev/null +++ b/src/internal/server/config_handler.go @@ -0,0 +1,10 @@ +package server + +// REFACTOR: UNIVERSAL SERVER CODE +import ( + "github.com/gofiber/fiber/v2" +) + +func (s *Server) ConfigHandler(c *fiber.Ctx) error { + return c.JSON(s.Config) +} diff --git a/src/internal/server/health_handler.go b/src/internal/server/health_handler.go index 9ee28b1..f171220 100644 --- a/src/internal/server/health_handler.go +++ b/src/internal/server/health_handler.go @@ -1,7 +1,7 @@ package server import ( - def "git.pbiernat.dev/egommerce/api-entities/http" + def "git.pbiernat.io/egommerce/api-entities/http" "github.com/gofiber/fiber/v2" ) @@ -10,7 +10,3 @@ func (s *Server) HealthHandler(c *fiber.Ctx) error { Status: "OK", }) } - -func (s *Server) ConfigHandler(c *fiber.Ctx) error { - return c.JSON(s.Config) -} diff --git a/src/internal/server/middleware.go b/src/internal/server/middleware.go index 74e2cda..165472c 100644 --- a/src/internal/server/middleware.go +++ b/src/internal/server/middleware.go @@ -5,14 +5,13 @@ import ( "github.com/gofiber/fiber/v2" - "git.pbiernat.dev/egommerce/go-api-pkg/fluentd" + "git.pbiernat.io/egommerce/go-api-pkg/fluentd" ) // "github.com/gofiber/fiber/v2" // "github.com/gofiber/fiber/v2/middleware/cors" func SetupMiddleware(s *Server) { - s.Base.Use(defaultCORS) s.Base.Use(LoggingMiddleware(s.Logger)) } diff --git a/src/internal/server/router.go b/src/internal/server/router.go index 75e966c..6f8410a 100644 --- a/src/internal/server/router.go +++ b/src/internal/server/router.go @@ -1,9 +1,6 @@ package server import ( - "net/http" - - "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/cors" ) @@ -18,6 +15,7 @@ var ( func SetupRouter(s *Server) { s.Base.Options("*", defaultCORS) + s.Base.Use(defaultCORS) s.Base.Get("/health", s.HealthHandler) s.Base.Get("/config", s.ConfigHandler) @@ -29,12 +27,3 @@ func SetupRouter(s *Server) { v1.Post("/product", s.AddProductToBasketHandler) v1.Delete("/product", s.RemoveProductFromBasketHandler) } - -func CORSPreflightMiddleware(c *fiber.Ctx) error { - if string(c.Request().Header.Method()) == http.MethodOptions { - c.Response().SetStatusCode(http.StatusOK) - c.Next() - } - - return c.Next() -} diff --git a/src/internal/server/server.go b/src/internal/server/server.go index 630553f..4991149 100644 --- a/src/internal/server/server.go +++ b/src/internal/server/server.go @@ -2,44 +2,40 @@ package server import ( "bytes" - "context" "encoding/json" "log" "os" "strconv" "time" - "github.com/go-redis/redis/v8" + "git.pbiernat.io/egommerce/go-api-pkg/consul" + "git.pbiernat.io/egommerce/go-api-pkg/fluentd" + redis "github.com/go-redis/redis/v8" "github.com/jackc/pgx/v5/pgxpool" "github.com/streadway/amqp" - "git.pbiernat.dev/egommerce/go-api-pkg/consul" - "git.pbiernat.dev/egommerce/go-api-pkg/fluentd" + db "git.pbiernat.io/egommerce/catalog-service/pkg/database" + p "git.pbiernat.io/egommerce/catalog-service/pkg/server" - db "git.pbiernat.dev/egommerce/catalog-service/pkg/database" - srv "git.pbiernat.dev/egommerce/catalog-service/pkg/server" - - cnf "git.pbiernat.dev/egommerce/catalog-service/internal/config" + "git.pbiernat.io/egommerce/catalog-service/internal" ) type ( Server struct { - Base *srv.Server - Config *cnf.Config - + Base *p.Server + Config *internal.Config Cache *redis.Client Database *pgxpool.Pool Eventbus *amqp.Channel Logger *fluentd.Logger Registry *consul.Service } - - OptionFn func(*Server) error // FIXME: similar in worker + OptionFn func(*Server) error ) -func New(c *cnf.Config, opts ...OptionFn) *Server { +func New(c *internal.Config, opts ...OptionFn) *Server { svr := &Server{ - Base: srv.New(c.Base), + Base: p.New(c.Base), Config: c, } @@ -49,115 +45,20 @@ func New(c *cnf.Config, opts ...OptionFn) *Server { } } + svr.Base.ShutdownFn = svr.Shutdown() + SetupMiddleware(svr) SetupRouter(svr) return svr } -func WithCache(c *cnf.Config) OptionFn { - redis := redis.NewClient(&redis.Options{ - Addr: c.CacheAddr, - Password: c.CachePassword, - DB: 0, - }) - - return func(s *Server) error { - s.Cache = redis - - return nil - } -} - -func WithDatabase(c *cnf.Config) OptionFn { - dbConn, err := db.Connect(c.DbURL) - if err != nil { - log.Fatalf("Failed to connect to the Database: %s. Err: %v\n", c.DbURL, err) - os.Exit(1) - } - - return func(s *Server) error { - s.Database = dbConn - - return nil - } -} - -func WithEventbus(c *cnf.Config) OptionFn { - conn, err := amqp.Dial(c.EventBusURL) - if err != nil { - log.Fatalf("Failed to connect to the Eventbus: %s. Err: %v\n", c.EventBusURL, err) - } - - chn, err := conn.Channel() - if err != nil { - log.Fatalf("Failed to open new Eventbus channel. Err: %v\n", err) - } - - return func(s *Server) error { - s.Eventbus = chn - - return nil - } -} - -func WithLogger(c *cnf.Config) OptionFn { - return func(s *Server) error { - logHost, logPort, err := fluentd.ParseAddr(c.LoggerAddr) - if err != nil { - log.Fatalf("Failed to parse Fluentd address: %s. Err: %v", c.LoggerAddr, err) - } - - logger, err := fluentd.NewLogger(c.Base.GetAppFullName(), logHost, logPort) - if err != nil { - log.Fatalf("Failed to connect to the Fluentd on %s:%d. Err: %v", logHost, logPort, err) - } - - s.Logger = logger - - return nil - } -} - -func WithRegistry(c *cnf.Config) OptionFn { - return func(s *Server) error { - port, _ := strconv.Atoi(c.Base.NetAddr[1:]) // FIXME: can be IP:PORT which will cause error - registry, err := consul.NewService(c.RegistryAddr, c.Base.AppID, c.Base.AppName, c.Base.AppID, c.Base.AppName, c.Base.PathPrefix, port) - if err != nil { - log.Fatalf("Failed to connect to the Consul on: %s. Err: %v", c.RegistryAddr, err) - } - - err = registry.Register() - if err != nil { - log.Fatalf("Failed to register in the Consul service. Err: %v", err) - } - - s.Registry = registry - - go func() { // Consul KV updater - ticker := time.NewTicker(time.Second * 15) - for range ticker.C { - updateKVConfig(s) - } - }() - - go func() { // Server metadata cache updater - ticker := time.NewTicker(time.Second * 5) - for range ticker.C { - s.cacheMetadata() - } - }() - - return nil - } -} - -func (s *Server) Shutdown() srv.PurgeFn { - return func(srv *srv.Server) error { +func (s *Server) Shutdown() p.ShutdownFn { + return func() error { s.Logger.Log("Server %s is going down...", s.Base.AppID) s.Registry.Unregister() - s.clearMetadataCache() + // s.clearMetadataCache() s.Eventbus.Close() s.Database.Close() s.Logger.Log("Gone.") @@ -168,38 +69,141 @@ func (s *Server) Shutdown() srv.PurgeFn { } // @CHECK: merge s.Config and s.Base.Config to display all config as one array/map -func updateKVConfig(s *Server) { // @FIXME: merge duplication in server.go and worker.go - config, _, err := s.Registry.KV().Get(s.Config.KVNamespace, nil) - if err != nil || config == nil { - return - } +func (s *Server) registerKVUpdater() { // @FIXME: merge duplication in server.go and worker.go + go func() { + ticker := time.NewTicker(time.Second * 10) + for range ticker.C { + config, _, err := s.Registry.KV().Get(s.Config.KVNamespace, nil) + if err != nil || config == nil { + return + } - kvCnf := bytes.NewBuffer(config.Value) - decoder := json.NewDecoder(kvCnf) - if err := decoder.Decode(&s.Config); err != nil { - return + kvCnf := bytes.NewBuffer(config.Value) + decoder := json.NewDecoder(kvCnf) + if err := decoder.Decode(&s.Config); err != nil { + return + } + } + }() +} + +// func (s *Server) clearMetadataCache() { +// ctx := context.Background() +// key, address := s.getMetadataIPsKey(), s.Config.Base.AppID + +// s.Cache.LRem(ctx, key, 0, address) +// } + +// func (s *Server) getMetadataIPsKey() string { +// return "internal__" + s.Base.Config.AppName + "__ips" +// } + +func WithCache(c *internal.Config) OptionFn { + return func(s *Server) error { + s.Cache = redis.NewClient(&redis.Options{ + Addr: s.Config.CacheAddr, + Password: s.Config.CachePassword, + DB: 0, + }) + + return nil } } -func (s *Server) cacheMetadata() { - ctx := context.Background() - key, address := s.getMetadataIPsKey(), s.Base.Config.AppID +func WithDatabase(c *internal.Config) OptionFn { + return func(s *Server) error { + dbConn, err := db.Connect(s.Config.DbURL) + if err != nil { + log.Fatalf("Failed to connect to the Database: %s. Err: %v\n", s.Config.DbURL, err) + os.Exit(1) + } - pos := s.Cache.LPos(ctx, key, address, redis.LPosArgs{}).Val() - if pos >= 0 { - s.Cache.LRem(ctx, key, 0, address) + s.Database = dbConn + + return nil } - - s.Cache.LPush(ctx, key, address).Err() } -func (s *Server) clearMetadataCache() { - ctx := context.Background() - key, address := s.getMetadataIPsKey(), s.Config.Base.AppID +func WithEventbus(c *internal.Config) OptionFn { + return func(s *Server) error { + conn, err := amqp.Dial(s.Config.EventBusURL) + if err != nil { + log.Fatalf("Failed to connect to the Eventbus: %s. Err: %v\n", s.Config.EventBusURL, err) + } - s.Cache.LRem(ctx, key, 0, address) + chn, err := conn.Channel() + if err != nil { + log.Fatalf("Failed to open new Eventbus channel. Err: %v\n", err) + } + + s.Eventbus = chn + + return nil + } } -func (s *Server) getMetadataIPsKey() string { - return "internal__" + s.Base.Config.AppName + "__ips" +func WithLogger(c *internal.Config) OptionFn { + return func(s *Server) error { + logHost, logPort, err := fluentd.ParseAddr(s.Config.LoggerAddr) + if err != nil { + log.Fatalf("Failed to parse Fluentd address: %s. Err: %v", s.Config.LoggerAddr, err) + } + + logger, err := fluentd.NewLogger(s.Config.Base.GetAppFullName(), logHost, logPort) + if err != nil { + log.Fatalf("Failed to connect to the Fluentd on %s:%d. Err: %v", logHost, logPort, err) + } + + s.Logger = logger + + return nil + } +} + +func WithRegistry(c *internal.Config) OptionFn { + return func(s *Server) error { + c := s.Config + + port, _ := strconv.Atoi(c.Base.NetAddr[1:]) // FIXME: can be IP:PORT which will cause error + registry, err := consul.NewService(c.RegistryAddr, c.Base.AppID, c.Base.AppName, c.Base.GetIP(), c.Base.AppDomain, c.Base.PathPrefix, port) + if err != nil { + log.Fatalf("Failed to connect to the Consul on: %s. Err: %v", c.RegistryAddr, err) + } + + err = registry.Register() + if err != nil { + log.Fatalf("Failed to register in the Consul service. Err: %v", err) + } + + registry.RegisterHealthChecks() + s.registerKVUpdater() + + s.Registry = registry + + // svc, err := registry.Connect() + // if err != nil { + // log.Fatalf("Failed to initialize Consul Connect service. Err: %v", err) + // } + + // confUpdated := make(chan bool, 1) + // go func(s *Server) { // startup register + // ticker := time.NewTicker(time.Second * 5) + // for range ticker.C { + // tlsCnf := svc.ServerTLSConfig() + // if len(tlsCnf.Certificates) > 0 { // FIXME more complex checking(validity date) + // fmt.Println("certs: ", tlsCnf.Certificates) + // confUpdated <- true + // } + // s.Base.App.Server().TLSConfig = tlsCnf + // fmt.Printf("CERTY TLS [routine]: %v\n", tlsCnf.Certificates) + // } + // }(s) + + // fmt.Println("Waiting until receive certs...") + // <-confUpdated + // fmt.Println("CONTINUE STARTING...") + // defer svc.Close() // tmp - ensure svc.Close is called on exit + + return nil + } } diff --git a/src/internal/service/catalog.go b/src/internal/service/catalog.go index bab428b..aebc338 100644 --- a/src/internal/service/catalog.go +++ b/src/internal/service/catalog.go @@ -3,10 +3,10 @@ package service import ( "context" - "git.pbiernat.dev/egommerce/api-entities/model" - "git.pbiernat.dev/egommerce/catalog-service/internal/event" - "git.pbiernat.dev/egommerce/go-api-pkg/fluentd" - "git.pbiernat.dev/egommerce/go-api-pkg/rabbitmq" + "git.pbiernat.io/egommerce/api-entities/model" + "git.pbiernat.io/egommerce/catalog-service/internal/event" + "git.pbiernat.io/egommerce/go-api-pkg/fluentd" + "git.pbiernat.io/egommerce/go-api-pkg/rabbitmq" "github.com/georgysavva/scany/v2/pgxscan" "github.com/jackc/pgx/v5/pgxpool" "github.com/streadway/amqp" @@ -33,7 +33,7 @@ func (s *CatalogService) GetProduct(ctx context.Context, reqID string, productID return nil, err } - return product, nil // FIXME + return product, nil } func (s *CatalogService) GetProductList(ctx context.Context, reqID string, categoryID int) ([]*model.ProductModel, error) { @@ -55,7 +55,7 @@ func (s *CatalogService) GetProductList(ctx context.Context, reqID string, categ func (s *CatalogService) AddProductToBasket(reqID, basketID string, productID, qty int) error { s.log.Log("Adding product #%d to the basket #%s", productID, basketID) - msg := &event.ProductAddedToBasket{ + msg := &event.ProductAddedToBasket{ // FIXME:move level up (ui)?? Event: event.NewEvent("AddProductToBasket", reqID), BasketID: basketID, ProductID: productID, @@ -68,7 +68,7 @@ func (s *CatalogService) AddProductToBasket(reqID, basketID string, productID, q } func (s *CatalogService) RemoveProductFromBasket(reqID, basketID string, productID, qty int) error { - s.log.Log("Removed product#%s from basket#%s", productID, basketID) + s.log.Log("Removed product#%d from basket#%s", productID, basketID) msg := &event.ProductRemovedFromBasket{ Event: event.NewEvent("RemoveProductFromBasket", reqID), diff --git a/src/internal/ui/catalog.go b/src/internal/ui/catalog.go index 3faad9d..2e6be54 100644 --- a/src/internal/ui/catalog.go +++ b/src/internal/ui/catalog.go @@ -4,8 +4,8 @@ import ( "context" "time" - def "git.pbiernat.dev/egommerce/api-entities/http" - "git.pbiernat.dev/egommerce/catalog-service/internal/service" + def "git.pbiernat.io/egommerce/api-entities/http" + "git.pbiernat.io/egommerce/catalog-service/internal/service" ) func GetProductList(srv *service.CatalogService, categoryID int, reqID string) ([]def.GetProductResponse, error) { @@ -36,7 +36,7 @@ func GetProductList(srv *service.CatalogService, categoryID int, reqID string) ( func AddProductToBasket(srv *service.CatalogService, productID, qty int, basketID, reqID string) (*def.AddProductToBasketResponse, error) { ctx := context.Background() - res := &def.AddProductToBasketResponse{ProductID: 0} + res := &def.AddProductToBasketResponse{} product, err := srv.GetProduct(ctx, reqID, productID) if err != nil { diff --git a/src/internal/worker/command.go b/src/internal/worker/command.go index c675491..e03af15 100644 --- a/src/internal/worker/command.go +++ b/src/internal/worker/command.go @@ -1,7 +1,7 @@ package worker import ( - "git.pbiernat.dev/egommerce/catalog-service/internal/service" + "git.pbiernat.io/egommerce/catalog-service/internal/service" ) var ( @@ -18,6 +18,25 @@ type CommandRunner struct { cmd Command } +func NewCommandRunner(data map[string]interface{}, srvc *service.CatalogService) *CommandRunner { + rnr := &CommandRunner{} + rnr.cmd = getCommand((data["command"]).(string), srvc) + + return rnr +} + +func getCommand(cmd string, srvc *service.CatalogService) Command { + // fmt.Printf("getCommand: %v\n", cmd) + var c Command + + switch cmd { // FIXME + case "StockUpdated": + c = &StockUpdatedCommand{srvc} + } + + return c +} + func (r *CommandRunner) run(data CommandData) (bool, any) { return r.cmd.run(data) } diff --git a/src/internal/worker/ext.go b/src/internal/worker/ext.go new file mode 100644 index 0000000..d080ac1 --- /dev/null +++ b/src/internal/worker/ext.go @@ -0,0 +1,133 @@ +package worker + +import ( + "bytes" + "encoding/json" + "os" + "time" + + cnf "git.pbiernat.io/egommerce/catalog-service/internal/config" + "git.pbiernat.io/egommerce/catalog-service/pkg/database" + "git.pbiernat.io/egommerce/go-api-pkg/consul" + "git.pbiernat.io/egommerce/go-api-pkg/fluentd" + "git.pbiernat.io/egommerce/go-api-pkg/rabbitmq" + "github.com/go-redis/redis/v8" +) + +func WithCache(c *cnf.Config) OptionFn { + return func(w *Worker) error { + conn := redis.NewClient(&redis.Options{ + Addr: c.CacheAddr, + Password: c.CachePassword, + DB: 0, + }) + + w.Cache = conn + + return nil + } +} + +func WithDatabase(c *cnf.Config) OptionFn { + return func(w *Worker) error { + conn, err := database.Connect(c.DbURL) + if err != nil { + w.Logger.Log("Failed to connect to Database server: %v\n", err) + os.Exit(1) + } + + w.Database = conn + + return nil + } +} + +func WithEventbus(c *cnf.Config) OptionFn { + return func(w *Worker) error { + _, chn, err := rabbitmq.Open(c.EventBusURL) + if err != nil { + w.Logger.Log("Failed to connect to EventBus server: %v\n", err) + os.Exit(1) + } + + err = rabbitmq.NewExchange(chn, c.EventBusExchange) + if err != nil { + w.Logger.Log("Failed to declare EventBus exchange: %v\n", err) + os.Exit(1) + } + + _, err = chn.QueueDeclare( + c.EventBusQueue, // name + false, // durable + false, // delete when unused + false, // exclusive + false, // no-wait + nil, // arguments + ) + if err != nil { + w.Logger.Log("Failed to declare EventBus queue: %v\n", err) + os.Exit(1) + } + + // w.bindQueues() + rabbitmq.BindQueueToExchange(chn, c.EventBusQueue, c.EventBusExchange, "warehouse.catalog.stockUpdated") + + w.Eventbus = chn + + return nil + } +} + +func WithLogger(c *cnf.Config) OptionFn { + return func(w *Worker) error { + logHost, logPort, err := fluentd.ParseAddr(c.LoggerAddr) + if err != nil { + w.Logger.Log("Failed to parse Fluentd address: %s. Err: %v", c.LoggerAddr, err) + os.Exit(1) + } + + logger, err := fluentd.NewLogger(c.Base.GetAppFullName(), logHost, logPort) + if err != nil { + w.Logger.Log("Failed to connect to the Fluentd on %s:%d. Err: %v", logHost, logPort, err) + os.Exit(1) + } + + w.Logger = logger + + return nil + } +} + +func WithRegistry(c *cnf.Config) OptionFn { + return func(w *Worker) error { + registry, err := consul.NewService(c.RegistryAddr, c.Base.AppID, c.Base.AppName, c.Base.AppID, "", "", 0) + if err != nil { + w.Logger.Log("Error connecting to %s: %v", c.RegistryAddr, err) + } + + w.Registry = registry + + go func(w *Worker) { // Fetch Consul KV config and store it in app config + ticker := time.NewTicker(time.Second * 15) + for range ticker.C { + fetchKVConfig(w) // FIXME: duplicated in server + } + }(w) + + return nil + } + +} + +func fetchKVConfig(w *Worker) { // @FIXME: merge duplication in server.go and worker.go + config, _, err := w.Registry.KV().Get(w.Config.KVNamespace, nil) + if err != nil || config == nil { + return + } + + kvCnf := bytes.NewBuffer(config.Value) + decoder := json.NewDecoder(kvCnf) + if err := decoder.Decode(&w.Config); err != nil { + return + } +} diff --git a/src/internal/worker/worker.go b/src/internal/worker/worker.go index 629584a..4834aaa 100644 --- a/src/internal/worker/worker.go +++ b/src/internal/worker/worker.go @@ -1,29 +1,25 @@ package worker import ( - "bytes" - "encoding/json" "fmt" "log" "os" "os/signal" + "strconv" "strings" "syscall" - "time" "github.com/go-redis/redis/v8" "github.com/jackc/pgx/v5/pgxpool" "github.com/streadway/amqp" - "git.pbiernat.dev/egommerce/go-api-pkg/consul" - "git.pbiernat.dev/egommerce/go-api-pkg/fluentd" - "git.pbiernat.dev/egommerce/go-api-pkg/rabbitmq" + "git.pbiernat.io/egommerce/go-api-pkg/consul" + "git.pbiernat.io/egommerce/go-api-pkg/fluentd" + "git.pbiernat.io/egommerce/go-api-pkg/rabbitmq" - "git.pbiernat.dev/egommerce/catalog-service/pkg/database" - - cnf "git.pbiernat.dev/egommerce/catalog-service/internal/config" - "git.pbiernat.dev/egommerce/catalog-service/internal/event" - "git.pbiernat.dev/egommerce/catalog-service/internal/service" + cnf "git.pbiernat.io/egommerce/catalog-service/internal/config" + "git.pbiernat.io/egommerce/catalog-service/internal/event" + "git.pbiernat.io/egommerce/catalog-service/internal/service" ) type ( @@ -39,135 +35,17 @@ type ( ) func New(c *cnf.Config, opts ...OptionFn) *Worker { - wrk := &Worker{ + w := &Worker{ Config: c, } for _, opt := range opts { - if err := opt(wrk); err != nil { + if err := opt(w); err != nil { log.Fatalf("Failed to attach extension to the worker. Err: %v\n", err) } } - return wrk -} - -func WithCache(c *cnf.Config) OptionFn { - return func(w *Worker) error { - conn := redis.NewClient(&redis.Options{ - Addr: c.CacheAddr, - Password: c.CachePassword, - DB: 0, - }) - - w.Cache = conn - - return nil - } -} - -func WithDatabase(c *cnf.Config) OptionFn { - return func(w *Worker) error { - conn, err := database.Connect(c.DbURL) - if err != nil { - w.Logger.Log("Failed to connect to Database server: %v\n", err) - os.Exit(1) - } - - w.Database = conn - - return nil - } -} - -func WithEventbus(c *cnf.Config) OptionFn { - return func(w *Worker) error { - _, chn, err := rabbitmq.Open(c.EventBusURL) - if err != nil { - w.Logger.Log("Failed to connect to EventBus server: %v\n", err) - os.Exit(1) - } - - err = rabbitmq.NewExchange(chn, c.EventBusExchange) - if err != nil { - w.Logger.Log("Failed to declare EventBus exchange: %v\n", err) - os.Exit(1) - } - - _, err = chn.QueueDeclare( - c.EventBusQueue, // name - false, // durable - false, // delete when unused - false, // exclusive - false, // no-wait - nil, // arguments - ) - if err != nil { - w.Logger.Log("Failed to declare EventBus queue: %v\n", err) - os.Exit(1) - } - - // w.bindQueues() - rabbitmq.BindQueueToExchange(chn, c.EventBusQueue, c.EventBusExchange, "warehouse.catalog.stockUpdated") - - w.Eventbus = chn - - return nil - } -} - -func WithLogger(c *cnf.Config) OptionFn { - return func(w *Worker) error { - logHost, logPort, err := fluentd.ParseAddr(c.LoggerAddr) - if err != nil { - w.Logger.Log("Failed to parse Fluentd address: %s. Err: %v", c.LoggerAddr, err) - os.Exit(1) - } - - logger, err := fluentd.NewLogger(c.Base.GetAppFullName(), logHost, logPort) - if err != nil { - w.Logger.Log("Failed to connect to the Fluentd on %s:%d. Err: %v", logHost, logPort, err) - os.Exit(1) - } - - w.Logger = logger - - return nil - } -} - -func WithRegistry(c *cnf.Config) OptionFn { - return func(w *Worker) error { - registry, err := consul.NewService(c.RegistryAddr, c.Base.AppID, c.Base.AppName, c.Base.AppID, "", "", 0) - if err != nil { - w.Logger.Log("Error connecting to %s: %v", c.RegistryAddr, err) - } - - w.Registry = registry - - go func(w *Worker) { // Fetch Consul KV config and store it in app config - ticker := time.NewTicker(time.Second * 15) - for range ticker.C { - fetchKVConfig(w) - } - }(w) - - return nil - } -} - -// @CHECK: merge s.Config and s.Base.Config to display all config as one array/map -func fetchKVConfig(w *Worker) { // @FIXME: merge duplication in server.go and worker.go - config, _, err := w.Registry.KV().Get(w.Config.KVNamespace, nil) - if err != nil || config == nil { - return - } - - kvCnf := bytes.NewBuffer(config.Value) - decoder := json.NewDecoder(kvCnf) - if err := decoder.Decode(&w.Config); err != nil { - return - } + return w } func (w *Worker) Start(while chan struct{}) error { @@ -177,10 +55,12 @@ func (w *Worker) Start(while chan struct{}) error { <-sigint w.Shutdown() - close(while) }() + run := w.createRunFile("./app.run") // TODO move to common library (shared between server and worker) + defer w.removeRunFile(run) + err := w.doWork() if err != nil { log.Fatalf("Failed to start worker: %s. Reason: %v\n", w.Config.Base.AppID, err) @@ -204,6 +84,21 @@ func (w *Worker) Shutdown() error { return nil } +func (w *Worker) createRunFile(path string) *os.File { + run, err := os.Create(path) + if err != nil { + log.Fatalf("Failed to create run file. Reason: %v\n", err) + os.Exit(1) + } + run.WriteString(strconv.Itoa(os.Getpid())) + + return run +} + +func (w *Worker) removeRunFile(f *os.File) error { + return f.Close() +} + func (w *Worker) doWork() error { msgs, err := w.Eventbus.Consume( w.Config.EventBusQueue, // queue @@ -241,8 +136,6 @@ func (w *Worker) processMsg(srvc *service.CatalogService, d amqp.Delivery) { return } - rnr := &CommandRunner{} - name := fmt.Sprintf("%s", msg["event"]) data := (msg["data"]).(map[string]interface{}) // reqID := (data["request_id"]).(string) // FIXME Check input params! @@ -255,6 +148,7 @@ func (w *Worker) processMsg(srvc *service.CatalogService, d amqp.Delivery) { w.Logger.Log("Event: %s", event.EVENT_WAREHOUSE_STOCK_UPDATED) } + rnr := NewCommandRunner(data, srvc) ok, _ = rnr.run(data) if ok { w.Logger.Log("Successful executed message \"%s\"\n", name) @@ -264,6 +158,4 @@ func (w *Worker) processMsg(srvc *service.CatalogService, d amqp.Delivery) { w.Logger.Log("Error processing \"%s\": %s (%v)", name, err.Error(), err) d.Reject(false) // FIXME: or Nack(repeat until success - maybe message shout know...? - - return } diff --git a/src/pkg/config/config.go b/src/pkg/config/config.go deleted file mode 100644 index 67c6b43..0000000 --- a/src/pkg/config/config.go +++ /dev/null @@ -1,22 +0,0 @@ -package config - -import ( - "os" - - "github.com/joho/godotenv" -) - -var ErrLoadingEnvs error - -func init() { - ErrLoadingEnvs = godotenv.Load() -} - -func GetEnv(name string, defVal string) string { - env := os.Getenv(name) - if env == "" { - return defVal - } - - return env -} diff --git a/src/pkg/server/config.go b/src/pkg/server/config.go index fca21d3..411f17f 100644 --- a/src/pkg/server/config.go +++ b/src/pkg/server/config.go @@ -2,12 +2,15 @@ package server import ( "fmt" + "net" + "os" "time" ) type Config struct { AppID string AppName string + AppDomain string NetAddr string PathPrefix string @@ -19,3 +22,13 @@ type Config struct { func (c *Config) GetAppFullName() string { return fmt.Sprintf("%s_%s", c.AppName, c.AppID) } + +func (c *Config) GetIP() string { + host, _ := os.Hostname() + ips, _ := net.LookupIP(host) + for _, ip := range ips { + return ip.String() + } + + return host // hostname for the rescue... NOT! +} diff --git a/src/pkg/server/server.go b/src/pkg/server/server.go index 9f76a01..0ac0875 100644 --- a/src/pkg/server/server.go +++ b/src/pkg/server/server.go @@ -2,14 +2,16 @@ package server import ( "log" + "net" "os" "os/signal" + "strconv" "syscall" "time" "github.com/gofiber/fiber/v2" - "git.pbiernat.dev/egommerce/api-entities/http" + "git.pbiernat.io/egommerce/api-entities/http" ) type ( @@ -17,22 +19,22 @@ type ( *fiber.App *Config - addr string // e.g. "127.0.0.1:8080" - // name string // e.g. "awesome-rest-api" - // kvNmspc string + addr string // e.g. "127.0.0.1:80" + + ShutdownFn } HeaderRequestID struct { RequestID string `reqHeader:"x-request-id"` } - OptionFn func(*Server) error - PurgeFn func(*Server) error + OptionFn func(*Server) error + ShutdownFn func() error ) func New(conf *Config) *Server { return &Server{ App: fiber.New(fiber.Config{ AppName: conf.AppID, - ServerHeader: conf.AppName, + ServerHeader: conf.AppName + ":" + conf.AppID, ReadTimeout: conf.ReadTimeout * time.Millisecond, WriteTimeout: conf.WriteTimeout * time.Millisecond, IdleTimeout: conf.IdleTimeout * time.Millisecond, @@ -42,20 +44,25 @@ func New(conf *Config) *Server { } } -func (s *Server) Start(while chan struct{}, prgFn PurgeFn) error { +func (s *Server) Start(while chan struct{}) error { go func() { sigint := make(chan os.Signal, 1) signal.Notify(sigint, os.Interrupt, syscall.SIGINT, syscall.SIGTERM) <-sigint - if err := prgFn(s); err != nil { + if err := s.ShutdownFn(); err != nil { log.Fatalf("Failed to shutdown server. Reason: %v\n", err) } close(while) }() - err := s.Listen(s.addr) + run := s.createRunFile("./app.run") // TODO move to common library (shared between server and worker) + defer s.removeRunFile(run) + + ln, _ := net.Listen("tcp", s.addr) + // ln = tls.NewListener(ln, s.App.Server().TLSConfig) + err := s.Listener(ln) if err != nil { log.Fatalf("Failed to start server: %s. Reason: %v\n", s.Config.AppID, err) close(while) @@ -77,3 +84,18 @@ func (s *Server) GetRequestID(c *fiber.Ctx) (string, error) { func (s *Server) Error(c *fiber.Ctx, code int, msg string) error { return c.Status(code).JSON(http.ErrorResponse{Error: msg}) } + +func (s *Server) createRunFile(path string) *os.File { + run, err := os.Create(path) + if err != nil { + log.Fatalf("Failed to create run file. Reason: %v\n", err) + os.Exit(1) + } + run.WriteString(strconv.Itoa(os.Getpid())) + + return run +} + +func (s *Server) removeRunFile(f *os.File) error { + return f.Close() +}