diff --git a/.golangci.yml b/.golangci.yml
index bf47957..a2de546 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -35,6 +35,7 @@ linters:
- gomoddirectives #требует rqlite
- tagliatelle
- gomnd
+ - paralleltest
linters-settings:
funlen:
lines: 80
diff --git a/.version b/.version
index ff365e0..944880f 100644
--- a/.version
+++ b/.version
@@ -1 +1 @@
-3.1.3
+3.2.0
diff --git a/Dockerfile b/Dockerfile
index 9ea2628..2c00832 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM golang:1.23-alpine as builder
+FROM golang:1.24-alpine as builder
WORKDIR /build
ARG version
ENV version_env=$version
@@ -10,7 +10,7 @@ RUN go build -ldflags="-X 'main.version=$version_env'" -o /main .
WORKDIR cmd/migrate
RUN CGO_ENABLED=1 go build -o /migrate .
-FROM alpine:3.20
+FROM alpine:3.21
RUN apk add --no-cache tzdata
RUN cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime
diff --git a/Dockerfile.dit b/Dockerfile.dit
index 9b1ac2d..6f6e68d 100644
--- a/Dockerfile.dit
+++ b/Dockerfile.dit
@@ -1,5 +1,5 @@
FROM dockerhub.mos.ru/mosos/arbat:15.5 as builder
-RUN zypper --no-gpg-checks update -y && zypper --no-gpg-checks install -y go1.23 git
+RUN zypper --no-gpg-checks update -y && zypper --no-gpg-checks install -y go1.24 git
WORKDIR /build
ARG version
ENV version_env=$version
diff --git a/assembly/locator.go b/assembly/locator.go
index 59ff6df..925795f 100644
--- a/assembly/locator.go
+++ b/assembly/locator.go
@@ -4,6 +4,7 @@ import (
"context"
"isp-config-service/conf"
"isp-config-service/service/module/backend"
+ "isp-config-service/service/variable"
"net/http"
"net/http/httputil"
"net/url"
@@ -85,6 +86,10 @@ func (l Locator) Config() *Config {
configRepo := repository.NewConfig(l.db)
configSchemaRepo := repository.NewConfigSchema(l.db)
configHistoryRepo := repository.NewConfigHistory(l.db)
+ variableRepo := repository.NewVariable(l.db)
+
+ variableService := variable.NewService(variableRepo, configRepo, eventRepo)
+ variableController := api.NewVariable(variableService)
etpSrv := etp.NewServer(
etp.WithServerReadLimit(wsReadLimit),
@@ -99,6 +104,7 @@ func (l Locator) Config() *Config {
configRepo,
etpSrv.Rooms(),
emitter,
+ variableService,
l.logger,
)
@@ -119,6 +125,7 @@ func (l Locator) Config() *Config {
configSchemaRepo,
subscriptionService,
emitter,
+ variableService,
l.logger,
)
moduleController := controller.NewModule(moduleService, l.logger)
@@ -135,6 +142,7 @@ func (l Locator) Config() *Config {
configSchemaRepo,
eventRepo,
configHistoryApiService,
+ variableService,
)
configApiController := api.NewConfig(configApiService)
@@ -147,6 +155,7 @@ func (l Locator) Config() *Config {
ConfigApi: configApiController,
ConfigHistoryApi: configHistoryController,
ConfigSchemaApi: configSchemaController,
+ VariableApi: variableController,
}
mapper := endpoint.DefaultWrapper(l.logger)
grpcMux := routes.GrpcHandler(mapper, controllers)
diff --git a/changelog.md b/changelog.md
index f3ab7d8..ea99cc9 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,3 +1,5 @@
+## v3.2.0
+* добавлена поддержка переменных в конфигурациях
## v3.1.2
* возвращена поддержка rqlite.DiscoMode `dns` и `dns-srv`
* добавлена поддержка работы в `kubernetes` c autodiscovery
diff --git a/cmd/migrate/go.mod b/cmd/migrate/go.mod
index 7b4f5e9..9481289 100644
--- a/cmd/migrate/go.mod
+++ b/cmd/migrate/go.mod
@@ -1,15 +1,15 @@
module isp-config-service/migrate
-go 1.23
+go 1.24
replace isp-config-service => ../..
require (
github.com/jmoiron/sqlx v1.4.0
- github.com/mattn/go-sqlite3 v1.14.22
+ github.com/mattn/go-sqlite3 v1.14.24
github.com/pkg/errors v0.9.1
- github.com/pressly/goose/v3 v3.22.1
- github.com/txix-open/isp-kit v1.39.2
+ github.com/pressly/goose/v3 v3.24.1
+ github.com/txix-open/isp-kit v1.45.0
isp-config-service v0.0.0-00010101000000-000000000000
)
@@ -19,20 +19,20 @@ require (
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/coder/websocket v1.8.12 // indirect
- github.com/gabriel-vasile/mimetype v1.4.6 // indirect
+ github.com/gabriel-vasile/mimetype v1.4.8 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/google/uuid v1.6.0 // indirect
- github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect
+ github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
- github.com/jackc/pgx/v5 v5.7.1 // indirect
+ github.com/jackc/pgx/v5 v5.7.2 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
- github.com/klauspost/compress v1.17.11 // indirect
+ github.com/klauspost/compress v1.18.0 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
@@ -41,36 +41,37 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
- github.com/prometheus/client_golang v1.20.5 // indirect
+ github.com/prometheus/client_golang v1.21.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
- github.com/prometheus/common v0.60.1 // indirect
+ github.com/prometheus/common v0.62.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/sethvargo/go-retry v0.3.0 // indirect
github.com/tidwall/gjson v1.18.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
- github.com/tidwall/pretty v1.2.1 // indirect
+ github.com/tidwall/pretty v1.2.0 // indirect
github.com/txix-open/bellows v1.2.0 // indirect
github.com/txix-open/etp/v4 v4.0.1 // indirect
github.com/txix-open/validator/v10 v10.0.0-20240401163703-e83541b40f99 // indirect
- go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.56.0 // indirect
- go.opentelemetry.io/otel v1.31.0 // indirect
- go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect
- go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 // indirect
- go.opentelemetry.io/otel/metric v1.31.0 // indirect
- go.opentelemetry.io/otel/sdk v1.31.0 // indirect
- go.opentelemetry.io/otel/trace v1.31.0 // indirect
- go.opentelemetry.io/proto/otlp v1.3.1 // indirect
+ go.opentelemetry.io/auto/sdk v1.1.0 // indirect
+ go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.60.0 // indirect
+ go.opentelemetry.io/otel v1.35.0 // indirect
+ go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 // indirect
+ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0 // indirect
+ go.opentelemetry.io/otel/metric v1.35.0 // indirect
+ go.opentelemetry.io/otel/sdk v1.35.0 // indirect
+ go.opentelemetry.io/otel/trace v1.35.0 // indirect
+ go.opentelemetry.io/proto/otlp v1.5.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
- golang.org/x/crypto v0.28.0 // indirect
- golang.org/x/net v0.30.0 // indirect
- golang.org/x/sync v0.8.0 // indirect
- golang.org/x/sys v0.26.0 // indirect
- golang.org/x/text v0.19.0 // indirect
- google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38 // indirect
- google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect
- google.golang.org/grpc v1.67.1 // indirect
- google.golang.org/protobuf v1.35.1 // indirect
+ golang.org/x/crypto v0.36.0 // indirect
+ golang.org/x/net v0.37.0 // indirect
+ golang.org/x/sync v0.12.0 // indirect
+ golang.org/x/sys v0.31.0 // indirect
+ golang.org/x/text v0.23.0 // indirect
+ google.golang.org/genproto/googleapis/api v0.0.0-20250311190419-81fb87f6b8bf // indirect
+ google.golang.org/genproto/googleapis/rpc v0.0.0-20250311190419-81fb87f6b8bf // indirect
+ google.golang.org/grpc v1.71.0 // indirect
+ google.golang.org/protobuf v1.36.5 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
diff --git a/cmd/migrate/go.sum b/cmd/migrate/go.sum
index 0198f44..5f68e37 100644
--- a/cmd/migrate/go.sum
+++ b/cmd/migrate/go.sum
@@ -13,17 +13,16 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL
github.com/coder/websocket v1.8.12 h1:5bUXkEPPIbewrnkU8LTCLVaxi4N4J8ahufH2vlo4NAo=
github.com/coder/websocket v1.8.12/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs=
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/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
-github.com/gabriel-vasile/mimetype v1.4.6 h1:3+PzJTKLkvgjeTbts6msPJt4DixhT4YtFNf1gtGe3zc=
-github.com/gabriel-vasile/mimetype v1.4.6/go.mod h1:JX1qVKqZd40hUPpAfiNTe0Sne7hdfKSbOqqmkq8GCXc=
-github.com/getsentry/sentry-go v0.29.1 h1:DyZuChN8Hz3ARxGVV8ePaNXh1dQ7d76AiB117xcREwA=
-github.com/getsentry/sentry-go v0.29.1/go.mod h1:x3AtIzN01d6SiWkderzaH28Tm0lgkafpJ5Bm3li39O0=
+github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=
+github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=
+github.com/getsentry/sentry-go v0.31.1 h1:ELVc0h7gwyhnXHDouXkhqTFSO5oslsRDk0++eyE0KJ4=
+github.com/getsentry/sentry-go v0.31.1/go.mod h1:CYNcMMz73YigoHljQRG+qPF+eMq8gG72XcGN/p71BAY=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
@@ -35,17 +34,19 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
-github.com/go-resty/resty/v2 v2.15.3 h1:bqff+hcqAflpiF591hhJzNdkRsFhlB96CYfBwSFvql8=
-github.com/go-resty/resty/v2 v2.15.3/go.mod h1:0fHAoK7JoBy/Ch36N8VFeMsK7xQOHhvWaC3iOktwmIU=
+github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM=
+github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA=
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
-github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
-github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
+github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
+github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
+github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
+github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
-github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys=
-github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I=
+github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo=
+github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI=
github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c=
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
@@ -55,8 +56,8 @@ github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsI
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
-github.com/jackc/pgx/v5 v5.7.1 h1:x7SYsPBYDkHDksogeSmZZ5xzThcTgRz++I5E+ePFUcs=
-github.com/jackc/pgx/v5 v5.7.1/go.mod h1:e7O26IywZZ+naJtWWos6i6fvWK+29etgITqrqHLfoZA=
+github.com/jackc/pgx/v5 v5.7.2 h1:mLoDLV6sonKlvjIEsV56SkWNCnuNv531l94GaIzO+XI=
+github.com/jackc/pgx/v5 v5.7.2/go.mod h1:ncY89UGWxg82EykZUwSpUKEfccBGGYq1xjrOpsbsfGQ=
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o=
@@ -65,8 +66,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
-github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
-github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
+github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
+github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -83,8 +84,9 @@ github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
-github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
+github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM=
+github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY=
github.com/mfridman/interpolate v0.0.2/go.mod h1:p+7uk6oE07mpE/Ik1b8EckO0O4ZXiGAfshKBWLUM9Xg=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
@@ -100,17 +102,16 @@ github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdh
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
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/pressly/goose/v3 v3.22.1 h1:2zICEfr1O3yTP9BRZMGPj7qFxQ+ik6yeo+z1LMuioLc=
-github.com/pressly/goose/v3 v3.22.1/go.mod h1:xtMpbstWyCpyH+0cxLTMCENWBG+0CSxvTsXhW95d5eo=
-github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
-github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
+github.com/pressly/goose/v3 v3.24.1 h1:bZmxRco2uy5uu5Ng1MMVEfYsFlrMJI+e/VMXHQ3C4LY=
+github.com/pressly/goose/v3 v3.24.1/go.mod h1:rEWreU9uVtt0DHCyLzF9gRcWiiTF/V+528DV+4DORug=
+github.com/prometheus/client_golang v1.21.1 h1:DOvXXTqVzvkIewV/CDPFdejpMCGeMcbGCQ8YOmu+Ibk=
+github.com/prometheus/client_golang v1.21.1/go.mod h1:U9NM32ykUErtVBxdvD3zfi+EuFkkaBvMb09mIfe0Zgg=
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
-github.com/prometheus/common v0.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPAaSc=
-github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw=
+github.com/prometheus/common v0.62.0 h1:xasJaQlnWAeyHdUBeGjXmutelfJHWMRr+Fg4QszZ2Io=
+github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkqml0W5zIY1I=
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
@@ -129,65 +130,69 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
-github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
+github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
+github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
+github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
-github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
-github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/txix-open/bellows v1.2.0 h1:CXv8nQaZtB/micraeRilYyj/gtfv+bqBgP5aPYQgjeY=
github.com/txix-open/bellows v1.2.0/go.mod h1:qbKCy+RTgD30Qpw1fyb3y3jp5Y9mGhLLxgae1l0W92o=
github.com/txix-open/etp/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIgA=
github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8=
-github.com/txix-open/isp-kit v1.39.2 h1:2L2LFwi+sNop9NeLDQ4scIy8LuohzXh4EBejHApAeDM=
-github.com/txix-open/isp-kit v1.39.2/go.mod h1:xB6mkoOewZBI1ND8kjU5TR6kvLu3VQI3Rdkh6g6FE4I=
+github.com/txix-open/isp-kit v1.45.0 h1:GPrr4F5SLQsrXgUTCqHL7C90vygjmNPOimUCAuXr2dw=
+github.com/txix-open/isp-kit v1.45.0/go.mod h1:efg4qDdAuw9Doi1OoT+OYSbr34B3j9u2ubz9R5BXYto=
github.com/txix-open/validator/v10 v10.0.0-20240401163703-e83541b40f99 h1:Z0Sqf+U+Sc6hfIXtRCIZlbJprkCjwMFbS4ZbEPQ44To=
github.com/txix-open/validator/v10 v10.0.0-20240401163703-e83541b40f99/go.mod h1:pA0NYmhL0uEkkxj55S+S7MZU4e2QIt46x9XSrzrWc3c=
-go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.56.0 h1:4BZHA+B1wXEQoGNHxW8mURaLhcdGwvRnmhGbm+odRbc=
-go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.56.0/go.mod h1:3qi2EEwMgB4xnKgPLqsDP3j9qxnHDZeHsnAxfjQqTko=
-go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s=
-go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM=
-go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY=
-go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 h1:K0XaT3DwHAcV4nKLzcQvwAgSyisUghWoY20I7huthMk=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0/go.mod h1:B5Ki776z/MBnVha1Nzwp5arlzBbE3+1jk+pGmaP5HME=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 h1:lUsI2TYsQw2r1IASwoROaCnjdj2cvC2+Jbxvk6nHnWU=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0/go.mod h1:2HpZxxQurfGxJlJDblybejHB6RX6pmExPNe517hREw4=
-go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE=
-go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY=
-go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk=
-go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0=
-go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys=
-go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A=
-go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0=
-go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8=
+go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
+go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
+go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.60.0 h1:0tY123n7CdWMem7MOVdKOt0YfshufLCwfE5Bob+hQuM=
+go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.60.0/go.mod h1:CosX/aS4eHnG9D7nESYpV753l4j9q5j3SL/PUYd2lR8=
+go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 h1:sbiXRNDSWJOTobXh5HyQKjq6wUC5tNybqjIqDpAY4CU=
+go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0/go.mod h1:69uWxva0WgAA/4bu2Yy70SLDBwZXuQ6PbBpbsa5iZrQ=
+go.opentelemetry.io/otel v1.35.0 h1:xKWKPxrxB6OtMCbmMY021CqC45J+3Onta9MqjhnusiQ=
+go.opentelemetry.io/otel v1.35.0/go.mod h1:UEqy8Zp11hpkUrL73gSlELM0DupHoiq72dR+Zqel/+Y=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 h1:1fTNlAIJZGWLP5FVu0fikVry1IsiUnXjf7QFvoNN3Xw=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0/go.mod h1:zjPK58DtkqQFn+YUMbx0M2XV3QgKU0gS9LeGohREyK4=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0 h1:xJ2qHD0C1BeYVTLLR9sX12+Qb95kfeD/byKj6Ky1pXg=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0/go.mod h1:u5BF1xyjstDowA1R5QAO9JHzqK+ublenEW/dyqTjBVk=
+go.opentelemetry.io/otel/metric v1.35.0 h1:0znxYu2SNyuMSQT4Y9WDWej0VpcsxkuklLa4/siN90M=
+go.opentelemetry.io/otel/metric v1.35.0/go.mod h1:nKVFgxBZ2fReX6IlyW28MgZojkoAkJGaE8CpgeAU3oE=
+go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY=
+go.opentelemetry.io/otel/sdk v1.35.0/go.mod h1:+ga1bZliga3DxJ3CQGg3updiaAJoNECOgJREo9KHGQg=
+go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk=
+go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w=
+go.opentelemetry.io/otel/trace v1.35.0 h1:dPpEfJu1sDIqruz7BHFG3c7528f6ddfSWfFDVt/xgMs=
+go.opentelemetry.io/otel/trace v1.35.0/go.mod h1:WUk7DtFp1Aw2MkvqGdwiXYDZZNvA/1J8o6xRXLrIkyc=
+go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4=
+go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
-golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
-golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
-golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
-golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
-golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
-golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
-golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
-golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
-golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
-golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
-google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38 h1:2oV8dfuIkM1Ti7DwXc0BJfnwr9csz4TDXI9EmiI+Rbw=
-google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38/go.mod h1:vuAjtvlwkDKF6L1GQ0SokiRLCGFfeBUXWr/aFFkHACc=
-google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 h1:zciRKQ4kBpFgpfC5QQCVtnnNAcLIqweL7plyZRQHVpI=
-google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
-google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
-google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
-google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
-google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
+golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
+golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
+golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=
+golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
+golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
+golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
+golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
+golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
+golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
+golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
+google.golang.org/genproto/googleapis/api v0.0.0-20250311190419-81fb87f6b8bf h1:BdIVRm+fyDUn8lrZLPSlBCfM/YKDwUBYgDoLv9+DYo0=
+google.golang.org/genproto/googleapis/api v0.0.0-20250311190419-81fb87f6b8bf/go.mod h1:jbe3Bkdp+Dh2IrslsFCklNhweNTBgSYanP1UXhJDhKg=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20250311190419-81fb87f6b8bf h1:dHDlF3CWxQkefK9IJx+O8ldY0gLygvrlYRBNbPqDWuY=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20250311190419-81fb87f6b8bf/go.mod h1:LuRYeWDFV6WOn90g357N17oMCaxpgCnbi/44qJvDn2I=
+google.golang.org/grpc v1.71.0 h1:kF77BGdPTQ4/JZWMlb9VpJ5pa25aqvVqogsxNHHdeBg=
+google.golang.org/grpc v1.71.0/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec=
+google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
+google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
@@ -198,12 +203,14 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 h1:5D53IMaUuA5InSeMu9eJtlQXS2NxAhyWQvkKEgXZhHI=
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6/go.mod h1:Qz0X07sNOR1jWYCrJMEnbW/X55x206Q7Vt4mz6/wHp4=
+modernc.org/libc v1.55.3 h1:AzcW1mhlPNrRtjS5sS+eW2ISCgSOLLNyFzRh/V3Qj/U=
+modernc.org/libc v1.55.3/go.mod h1:qFXepLhz+JjFThQ4kzwzOjA/y/artDeg+pcYnY+Q83w=
modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4=
modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo=
modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E=
modernc.org/memory v1.8.0/go.mod h1:XPZ936zp5OMKGWPqbD3JShgd/ZoQ7899TUuQqxY+peU=
-modernc.org/sqlite v1.33.0 h1:WWkA/T2G17okiLGgKAj4/RMIvgyMT19yQ038160IeYk=
-modernc.org/sqlite v1.33.0/go.mod h1:9uQ9hF/pCZoYZK73D/ud5Z7cIRIILSZI8NdIemVMTX8=
+modernc.org/sqlite v1.34.1 h1:u3Yi6M0N8t9yKRDwhXcyp1eS5/ErhPTBggxWFuR6Hfk=
+modernc.org/sqlite v1.34.1/go.mod h1:pXV2xHxhzXZsgT/RtTFAPY6JJDEvOTcTdwADQCCWD4k=
modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA=
modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0=
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
diff --git a/cmd/migrate/main.go b/cmd/migrate/main.go
index 7bf02a3..5afa018 100644
--- a/cmd/migrate/main.go
+++ b/cmd/migrate/main.go
@@ -1,6 +1,8 @@
package main
import (
+ "context"
+ "database/sql"
"fmt"
"github.com/pressly/goose/v3"
"github.com/txix-open/isp-kit/config"
@@ -34,6 +36,14 @@ type Cfg struct {
}
}
+type dbClient struct {
+ *db.Client
+}
+
+func (d dbClient) ExecTransaction(ctx context.Context, requests [][]any) ([]sql.Result, error) {
+ panic("implement me")
+}
+
func main() {
app, err := app.New(app.WithConfigOptions(
config.WithValidator(validator.Default),
@@ -58,7 +68,7 @@ func main() {
defer pgDb.Close()
fileName := fmt.Sprintf("db_%d.sqlite", time.Now().Unix())
- dbClient := &db.Client{}
+ dbClient := dbClient{&db.Client{}}
dbClient.DB, err = sqlx.Open("sqlite3", fileName)
dbClient.DB.MapperFunc(db.ToSnakeCase)
if err != nil {
diff --git a/controller/api/config.go b/controller/api/config.go
index b66d665..ed027c6 100644
--- a/controller/api/config.go
+++ b/controller/api/config.go
@@ -153,12 +153,12 @@ func (c Config) CreateUpdateConfig(
// @Tags Конфигурация
// @Accept json
// @Produce json
-// @Param body body domain.ConfigIdRequest true "id конфигурации"
+// @Param body body domain.IdRequest true "id конфигурации"
// @Success 200 {object} domain.Config
// @Failure 400 {object} apierrors.Error "`errorCode: 2002` - конфиг не найден
"
// @Failure 500 {object} apierrors.Error
// @Router /config/get_config_by_id [POST]
-func (c Config) GetConfigById(ctx context.Context, req domain.ConfigIdRequest) (*domain.Config, error) {
+func (c Config) GetConfigById(ctx context.Context, req domain.IdRequest) (*domain.Config, error) {
config, err := c.service.GetConfigById(ctx, req.Id)
switch {
case errors.Is(err, entity.ErrConfigNotFound):
@@ -180,12 +180,12 @@ func (c Config) GetConfigById(ctx context.Context, req domain.ConfigIdRequest) (
// @Tags Конфигурация
// @Accept json
// @Produce json
-// @Param body body domain.ConfigIdRequest true "id конфигурации для изменения"
+// @Param body body domain.IdRequest true "id конфигурации для изменения"
// @Success 200
// @Failure 400 {object} apierrors.Error "`errorCode: 2002` - конфиг не найден
"
// @Failure 500 {object} apierrors.Error
// @Router /config/mark_config_as_active [POST]
-func (c Config) MarkConfigAsActive(ctx context.Context, identity domain.ConfigIdRequest) error {
+func (c Config) MarkConfigAsActive(ctx context.Context, identity domain.IdRequest) error {
err := c.service.MarkConfigAsActive(ctx, identity.Id)
switch {
case errors.Is(err, entity.ErrConfigNotFound):
diff --git a/controller/api/config_history.go b/controller/api/config_history.go
index 844bccd..0ec56cf 100644
--- a/controller/api/config_history.go
+++ b/controller/api/config_history.go
@@ -28,12 +28,12 @@ func NewConfigHistory(service ConfigHistoryService) ConfigHistory {
// @Tags Конфигурация
// @Accept json
// @Produce json
-// @Param body body domain.ConfigIdRequest true "id конфигурации"
+// @Param body body domain.IdRequest true "id конфигурации"
// @Success 200 {array} domain.ConfigVersion
// @Failure 400 {object} apierrors.Error "если не указан массив идентификаторов"
// @Failure 500 {object} apierrors.Error
// @Router /config/get_all_version [POST]
-func (c ConfigHistory) GetAllVersion(ctx context.Context, req domain.ConfigIdRequest) ([]domain.ConfigVersion, error) {
+func (c ConfigHistory) GetAllVersion(ctx context.Context, req domain.IdRequest) ([]domain.ConfigVersion, error) {
versions, err := c.service.GetAllVersions(ctx, req.Id)
if err != nil {
return nil, apierrors.NewInternalServiceError(err)
@@ -47,12 +47,12 @@ func (c ConfigHistory) GetAllVersion(ctx context.Context, req domain.ConfigIdReq
// @Tags Конфигурация
// @Accept json
// @Produce json
-// @Param body body domain.ConfigIdRequest true "id версии конфигурации"
+// @Param body body domain.IdRequest true "id версии конфигурации"
// @Success 200 {object} domain.DeleteResponse
// @Failure 400 {object} apierrors.Error "не указан массив идентификаторов"
// @Failure 500 {object} apierrors.Error
// @Router /config/delete_version [POST]
-func (c ConfigHistory) DeleteConfigVersion(ctx context.Context, req domain.ConfigIdRequest) (*domain.DeleteResponse, error) {
+func (c ConfigHistory) DeleteConfigVersion(ctx context.Context, req domain.IdRequest) (*domain.DeleteResponse, error) {
err := c.service.Delete(ctx, req.Id)
if err != nil {
return nil, apierrors.NewInternalServiceError(err)
diff --git a/controller/api/variable.go b/controller/api/variable.go
new file mode 100644
index 0000000..6f608ad
--- /dev/null
+++ b/controller/api/variable.go
@@ -0,0 +1,150 @@
+//nolint:lll
+package api
+
+import (
+ "context"
+ "github.com/pkg/errors"
+ "github.com/txix-open/isp-kit/grpc/apierrors"
+ _ "github.com/txix-open/isp-kit/grpc/apierrors"
+ "isp-config-service/domain"
+ "isp-config-service/entity"
+)
+
+type Service interface {
+ All(ctx context.Context) ([]domain.Variable, error)
+ GetByName(ctx context.Context, name string) (*domain.Variable, error)
+ Create(ctx context.Context, req domain.CreateVariableRequest) error
+ Update(ctx context.Context, req domain.UpdateVariableRequest) error
+ Upsert(ctx context.Context, req []domain.UpsertVariableRequest) error
+ Delete(ctx context.Context, name string) error
+}
+
+type Variable struct {
+ service Service
+}
+
+func NewVariable(service Service) Variable {
+ return Variable{
+ service: service,
+ }
+}
+
+// All
+// @Summary Метод получения списка всех переменных
+// @Tags Переменные
+// @Accept json
+// @Produce json
+// @Success 200 {array} domain.Variable
+// @Failure 500 {object} apierrors.Error
+// @Router /variable/all [POST]
+func (c Variable) All(ctx context.Context) ([]domain.Variable, error) {
+ return c.service.All(ctx)
+}
+
+// GetByName
+// @Summary Метод получения переменной по точному совпадению имени
+// @Tags Переменные
+// @Accept json
+// @Produce json
+// @Param body body domain.VariableByNameRequest true "тело запроса"
+// @Success 200 {object} domain.Variable
+// @Failure 400 {object} apierrors.Error "`errorCode: 2006` - переменная по имени не найдена
"
+// @Failure 500 {object} apierrors.Error
+// @Router /variable/get_by_name [POST]
+func (c Variable) GetByName(ctx context.Context, req domain.VariableByNameRequest) (*domain.Variable, error) {
+ v, err := c.service.GetByName(ctx, req.Name)
+ switch {
+ case errors.Is(err, entity.ErrVariableNotFound):
+ return nil, apierrors.NewBusinessError(domain.ErrorCodeVariableNotFound, "variable by name not found", err)
+ case err != nil:
+ return nil, apierrors.NewInternalServiceError(err)
+ }
+ return v, nil
+}
+
+// Create
+// @Summary Метод создания новой переменной
+// @Description Создает новую переменную с указанным наименованием и значением
+// @Tags Переменные
+// @Accept json
+// @Produce json
+// @Param body body domain.CreateVariableRequest true "тело запроса"
+// @Success 200
+// @Failure 400 {object} apierrors.Error "`errorCode: 2007` - переменная с таким именем уже существует
"
+// @Failure 500 {object} apierrors.Error
+// @Router /variable/create [POST]
+func (c Variable) Create(ctx context.Context, req domain.CreateVariableRequest) error {
+ err := c.service.Create(ctx, req)
+ switch {
+ case errors.Is(err, entity.ErrVariableAlreadyExists):
+ return apierrors.NewBusinessError(domain.ErrorCodeVariableAlreadyExists, "variable with the same name already exists", err)
+ case err != nil:
+ return apierrors.NewInternalServiceError(err)
+ }
+ return nil
+}
+
+// Update
+// @Summary Метод обновления переменной
+// @Description Выполняет обновление переменной по ее названию
+// @Tags Переменные
+// @Accept json
+// @Produce json
+// @Param body body domain.UpdateVariableRequest true "тело запроса"
+// @Success 200
+// @Failure 400 {object} apierrors.Error "`errorCode: 2006` - переменная по имени не найдена
"
+// @Failure 500 {object} apierrors.Error
+// @Router /variable/update [POST]
+func (c Variable) Update(ctx context.Context, req domain.UpdateVariableRequest) error {
+ err := c.service.Update(ctx, req)
+ switch {
+ case errors.Is(err, entity.ErrVariableNotFound):
+ return apierrors.NewBusinessError(domain.ErrorCodeVariableNotFound, "variable by name not found", err)
+ case err != nil:
+ return apierrors.NewInternalServiceError(err)
+ }
+ return nil
+}
+
+// Upsert
+// @Summary Метод добавления/обновления переменных
+// @Description Выполняет безусловное добавление/обновление указанных в теле запроса переменных
+// @Description Операция выполняется не в транзакции
+// @Tags Переменные
+// @Accept json
+// @Produce json
+// @Param body body []domain.UpsertVariableRequest true "тело запроса"
+// @Success 200
+// @Failure 500 {object} apierrors.Error
+// @Router /variable/upsert [POST]
+func (c Variable) Upsert(ctx context.Context, req []domain.UpsertVariableRequest) error {
+ err := c.service.Upsert(ctx, req)
+ if err != nil {
+ return apierrors.NewInternalServiceError(err)
+ }
+ return nil
+}
+
+// Delete
+// @Summary Метод удаления переменной
+// @Description Переменная связанная с конфигурациями, не может быть удалена
+// @Tags Переменные
+// @Accept json
+// @Produce json
+// @Param body body domain.VariableByNameRequest true "тело запроса"
+// @Success 200
+// @Failure 400 {object} apierrors.Error "`errorCode: 2006` - переменная по имени не найдена
`errorCode: 2008` - переменная используется в конфигурациях
"
+// @Failure 500 {object} apierrors.Error
+// @Router /variable/delete [POST]
+func (c Variable) Delete(ctx context.Context, req domain.VariableByNameRequest) error {
+ err := c.service.Delete(ctx, req.Name)
+ switch {
+ case errors.Is(err, entity.ErrVariableNotFound):
+ return apierrors.NewBusinessError(domain.ErrorCodeVariableNotFound, "variable by name not found", err)
+ case errors.Is(err, entity.ErrVariableUsedInConfigs):
+ return apierrors.NewBusinessError(domain.ErrorCodeVariableUsedInConfigs, "variable used in configs", err)
+ case err != nil:
+ return apierrors.NewInternalServiceError(err)
+ }
+ return nil
+}
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 45581b8..030f967 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -28,13 +28,6 @@ definitions:
version:
type: integer
type: object
- domain.ConfigIdRequest:
- properties:
- id:
- type: string
- required:
- - id
- type: object
domain.ConfigSchema:
properties:
createdAt:
@@ -100,6 +93,21 @@ definitions:
- moduleId
- name
type: object
+ domain.CreateVariableRequest:
+ properties:
+ description:
+ type: string
+ name:
+ type: string
+ type:
+ type: string
+ value:
+ type: string
+ required:
+ - name
+ - type
+ - value
+ type: object
domain.DeleteResponse:
properties:
deleted:
@@ -126,6 +134,22 @@ definitions:
required:
- moduleName
type: object
+ domain.IdRequest:
+ properties:
+ id:
+ type: string
+ required:
+ - id
+ type: object
+ domain.LinkedConfig:
+ properties:
+ id:
+ type: string
+ moduleId:
+ type: string
+ name:
+ type: string
+ type: object
domain.ModuleInfo:
properties:
active:
@@ -147,6 +171,57 @@ definitions:
$ref: '#/definitions/domain.Connection'
type: array
type: object
+ domain.UpdateVariableRequest:
+ properties:
+ description:
+ type: string
+ name:
+ type: string
+ value:
+ type: string
+ required:
+ - name
+ - value
+ type: object
+ domain.UpsertVariableRequest:
+ properties:
+ description:
+ type: string
+ name:
+ type: string
+ value:
+ type: string
+ required:
+ - description
+ - name
+ - value
+ type: object
+ domain.Variable:
+ properties:
+ containsInConfigs:
+ items:
+ $ref: '#/definitions/domain.LinkedConfig'
+ type: array
+ createdAt:
+ type: string
+ description:
+ type: string
+ name:
+ type: string
+ type:
+ type: string
+ updatedAt:
+ type: string
+ value:
+ type: string
+ type: object
+ domain.VariableByNameRequest:
+ properties:
+ name:
+ type: string
+ required:
+ - name
+ type: object
github_com_txix-open_isp-kit_grpc_apierrors.Error:
properties:
details:
@@ -243,7 +318,7 @@ paths:
name: body
required: true
schema:
- $ref: '#/definitions/domain.ConfigIdRequest'
+ $ref: '#/definitions/domain.IdRequest'
produces:
- application/json
responses:
@@ -304,7 +379,7 @@ paths:
name: body
required: true
schema:
- $ref: '#/definitions/domain.ConfigIdRequest'
+ $ref: '#/definitions/domain.IdRequest'
produces:
- application/json
responses:
@@ -335,7 +410,7 @@ paths:
name: body
required: true
schema:
- $ref: '#/definitions/domain.ConfigIdRequest'
+ $ref: '#/definitions/domain.IdRequest'
produces:
- application/json
responses:
@@ -398,7 +473,7 @@ paths:
name: body
required: true
schema:
- $ref: '#/definitions/domain.ConfigIdRequest'
+ $ref: '#/definitions/domain.IdRequest'
produces:
- application/json
responses:
@@ -516,4 +591,170 @@ paths:
summary: Метод получения схемы конфигурации модуля
tags:
- Схема
+ /variable/all:
+ post:
+ consumes:
+ - application/json
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ items:
+ $ref: '#/definitions/domain.Variable'
+ type: array
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/github_com_txix-open_isp-kit_grpc_apierrors.Error'
+ summary: Метод получения списка всех переменных
+ tags:
+ - Переменные
+ /variable/create:
+ post:
+ consumes:
+ - application/json
+ description: Создает новую переменную с указанным наименованием и значением
+ parameters:
+ - description: тело запроса
+ in: body
+ name: body
+ required: true
+ schema:
+ $ref: '#/definitions/domain.CreateVariableRequest'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/domain.Variable'
+ "400":
+ description: '`errorCode: 2007` - переменная с таким именем уже существует
'
+ schema:
+ $ref: '#/definitions/github_com_txix-open_isp-kit_grpc_apierrors.Error'
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/github_com_txix-open_isp-kit_grpc_apierrors.Error'
+ summary: Метод создания новой переменной
+ tags:
+ - Переменные
+ /variable/delete:
+ post:
+ consumes:
+ - application/json
+ description: Переменная связанная с конфигурациями, не может быть удалена
+ parameters:
+ - description: тело запроса
+ in: body
+ name: body
+ required: true
+ schema:
+ $ref: '#/definitions/domain.VariableByNameRequest'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ "400":
+ description: '`errorCode: 2006` - переменная по имени не найдена
`errorCode:
+ 2008` - переменная используется в конфигурациях
'
+ schema:
+ $ref: '#/definitions/github_com_txix-open_isp-kit_grpc_apierrors.Error'
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/github_com_txix-open_isp-kit_grpc_apierrors.Error'
+ summary: Метод удаления переменной
+ tags:
+ - Переменные
+ /variable/get_by_name:
+ post:
+ consumes:
+ - application/json
+ parameters:
+ - description: тело запроса
+ in: body
+ name: body
+ required: true
+ schema:
+ $ref: '#/definitions/domain.VariableByNameRequest'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/domain.Variable'
+ "400":
+ description: '`errorCode: 2006` - переменная по имени не найдена
'
+ schema:
+ $ref: '#/definitions/github_com_txix-open_isp-kit_grpc_apierrors.Error'
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/github_com_txix-open_isp-kit_grpc_apierrors.Error'
+ summary: Метод получения переменной по точному совпадению имени
+ tags:
+ - Переменные
+ /variable/update:
+ post:
+ consumes:
+ - application/json
+ description: Выполняет обновление переменной по ее названию
+ parameters:
+ - description: тело запроса
+ in: body
+ name: body
+ required: true
+ schema:
+ $ref: '#/definitions/domain.UpdateVariableRequest'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/domain.Variable'
+ "400":
+ description: '`errorCode: 2006` - переменная по имени не найдена
'
+ schema:
+ $ref: '#/definitions/github_com_txix-open_isp-kit_grpc_apierrors.Error'
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/github_com_txix-open_isp-kit_grpc_apierrors.Error'
+ summary: Метод обновления переменной
+ tags:
+ - Переменные
+ /variable/upsert:
+ post:
+ consumes:
+ - application/json
+ description: |-
+ Выполняет безусловное добавление/обновление указанных в теле запроса переменных
+ Операция выполняется не в транзакции
+ parameters:
+ - description: тело запроса
+ in: body
+ name: body
+ required: true
+ schema:
+ items:
+ $ref: '#/definitions/domain.UpsertVariableRequest'
+ type: array
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/github_com_txix-open_isp-kit_grpc_apierrors.Error'
+ summary: Метод добавления/обновления переменных
+ tags:
+ - Переменные
swagger: "2.0"
diff --git a/domain/errors.go b/domain/errors.go
index ab2e4ae..6e1fbd6 100644
--- a/domain/errors.go
+++ b/domain/errors.go
@@ -12,6 +12,9 @@ const (
ErrorCodeInvalidConfig = 2003
ErrorCodeConfigVersionConflict = 2004
ErrorCodeSchemaNotFound = 2005
+ ErrorCodeVariableNotFound = 2006
+ ErrorCodeVariableAlreadyExists = 2007
+ ErrorCodeVariableUsedInConfigs = 2008
)
type ConfigValidationError struct {
diff --git a/domain/request.go b/domain/request.go
index 65cb20b..0cdf9b4 100644
--- a/domain/request.go
+++ b/domain/request.go
@@ -4,7 +4,7 @@ import (
"github.com/txix-open/isp-kit/json"
)
-type ConfigIdRequest struct {
+type IdRequest struct {
Id string `validate:"required"`
}
diff --git a/domain/variable.go b/domain/variable.go
new file mode 100644
index 0000000..7ec3df0
--- /dev/null
+++ b/domain/variable.go
@@ -0,0 +1,51 @@
+package domain
+
+import (
+ "isp-config-service/entity"
+ "time"
+)
+
+type Variable struct {
+ Name string
+ Description string
+ Type string
+ Value string
+ CreatedAt time.Time
+ UpdatedAt time.Time
+ ContainsInConfigs []LinkedConfig
+}
+
+type LinkedConfig struct {
+ Id string
+ ModuleId string
+ Name string
+}
+
+type CreateVariableRequest struct {
+ Name string `validate:"required"`
+ Description string
+ Type string `validate:"required,oneof=SECRET TEXT"`
+ Value string `validate:"required"`
+}
+
+type UpdateVariableRequest struct {
+ Name string `validate:"required"`
+ Description string
+ Value string `validate:"required"`
+}
+
+type UpsertVariableRequest struct {
+ Name string `validate:"required"`
+ Description string
+ Type string `validate:"required,oneof=SECRET TEXT"`
+ Value string `validate:"required"`
+}
+
+type VariableByNameRequest struct {
+ Name string `validate:"required"`
+}
+
+type VariableExtractionResult struct {
+ VariableLinks []entity.ConfigHasVariable
+ AbsentVariables []string
+}
diff --git a/entity/config.go b/entity/config.go
index ac3d8d4..d6f53a2 100644
--- a/entity/config.go
+++ b/entity/config.go
@@ -16,6 +16,14 @@ type Config struct {
UpdatedAt xtypes.Time `json:"updated_at"`
}
+type ConfigMetaWithVariable struct {
+ Id string `json:"id"`
+ Name string `json:"name"`
+ ModuleId string `json:"module_id"`
+ VariableName string `json:"variable_name"`
+ Active xtypes.Bool `json:"active"`
+}
+
type ConfigHistory struct {
Id string `json:"id"`
ConfigId string `json:"config_id"`
diff --git a/entity/errors.go b/entity/errors.go
index 8e14039..55da7b1 100644
--- a/entity/errors.go
+++ b/entity/errors.go
@@ -10,4 +10,7 @@ var (
ErrSchemaNotFound = errors.New("config schema not found")
ErrConfigNotFoundOrActive = errors.New("config not found or markers as active")
ErrConfigConflictUpdate = errors.New("config conflict update")
+ ErrVariableNotFound = errors.New("variable not found")
+ ErrVariableAlreadyExists = errors.New("variable already exists")
+ ErrVariableUsedInConfigs = errors.New("variable used in configs")
)
diff --git a/entity/variable.go b/entity/variable.go
new file mode 100644
index 0000000..7cbed2d
--- /dev/null
+++ b/entity/variable.go
@@ -0,0 +1,19 @@
+package entity
+
+import (
+ "isp-config-service/entity/xtypes"
+)
+
+type Variable struct {
+ Name string `json:"name"`
+ Description string `json:"description"`
+ Type string `json:"type"`
+ Value string `json:"value"`
+ CreatedAt xtypes.Time `json:"created_at"`
+ UpdatedAt xtypes.Time `json:"updated_at"`
+}
+
+type ConfigHasVariable struct {
+ ConfigId string `json:"config_id"`
+ VariableName string `json:"variable_name"`
+}
diff --git a/go.mod b/go.mod
index db6fe3c..ae0bbde 100644
--- a/go.mod
+++ b/go.mod
@@ -1,101 +1,103 @@
module isp-config-service
-go 1.23
+go 1.24
+
+replace (
+ github.com/armon/go-metrics => github.com/hashicorp/go-metrics v0.5.1
+ golang.org/x/text => golang.org/x/text v0.3.8
+)
require (
github.com/Masterminds/squirrel v1.5.4
github.com/google/uuid v1.6.0
github.com/pkg/errors v0.9.1
- github.com/pressly/goose/v3 v3.22.1
- github.com/prometheus/client_golang v1.20.5
- github.com/rqlite/gorqlite v0.0.0-20241013203532-4385768ae85d
- github.com/rqlite/rqlite-disco-clients v0.0.0-20231230135307-118e35426347
- github.com/rqlite/rqlite/v8 v8.32.5
- github.com/stretchr/testify v1.9.0
+ github.com/pressly/goose/v3 v3.24.1
+ github.com/prometheus/client_golang v1.21.1
+ github.com/rqlite/gorqlite v0.0.0-20250128004930-114c7828b55a
+ github.com/rqlite/rqlite-disco-clients v0.0.0-20250205044118-8ada2b350099
+ github.com/rqlite/rqlite/v8 v8.36.12
+ github.com/stretchr/testify v1.10.0
github.com/tidwall/gjson v1.18.0
github.com/txix-open/etp/v4 v4.0.1
- github.com/txix-open/isp-kit v1.39.2
+ github.com/txix-open/isp-kit v1.45.0
github.com/xeipuuv/gojsonschema v1.2.0
- golang.org/x/sync v0.8.0
- google.golang.org/grpc v1.67.1
+ golang.org/x/sync v0.12.0
+ google.golang.org/grpc v1.71.0
)
require (
- github.com/armon/go-metrics v0.5.3 // indirect
+ github.com/armon/go-metrics v0.5.4 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/coder/websocket v1.8.12 // indirect
- github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
+ github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.18.0 // indirect
- github.com/gabriel-vasile/mimetype v1.4.6 // indirect
- github.com/getsentry/sentry-go v0.29.1 // indirect
+ github.com/gabriel-vasile/mimetype v1.4.8 // indirect
+ github.com/getsentry/sentry-go v0.31.1 // indirect
+ github.com/go-faker/faker/v4 v4.6.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
- github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect
+ github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
+ github.com/hashicorp/go-metrics v0.5.4 // indirect
github.com/hashicorp/go-msgpack v1.1.5 // indirect
- github.com/hashicorp/go-msgpack/v2 v2.1.2 // indirect
- github.com/hashicorp/go-uuid v1.0.3 // indirect
+ github.com/hashicorp/go-msgpack/v2 v2.1.3 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
- github.com/hashicorp/raft v1.7.1 // indirect
+ github.com/hashicorp/raft v1.7.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
- github.com/klauspost/compress v1.17.11 // indirect
+ github.com/klauspost/compress v1.18.0 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
- github.com/mailru/easyjson v0.7.7 // indirect
- github.com/mattn/go-colorable v0.1.13 // indirect
+ github.com/mailru/easyjson v0.9.0 // indirect
+ github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mfridman/interpolate v0.0.2 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
- github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
+ github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
- github.com/prometheus/common v0.60.1 // indirect
+ github.com/prometheus/common v0.62.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
- github.com/rqlite/go-sqlite3 v1.36.0 // indirect
+ github.com/rqlite/go-sqlite3 v1.37.0 // indirect
github.com/rqlite/raft-boltdb/v2 v2.0.0-20230523104317-c08e70f4de48 // indirect
- github.com/rqlite/sql v0.0.0-20241029220113-152a320b02f7 // indirect
+ github.com/rqlite/sql v0.0.0-20241111133259-a4122fabb196 // indirect
github.com/sethvargo/go-retry v0.3.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
- github.com/tidwall/pretty v1.2.1 // indirect
+ github.com/tidwall/pretty v1.2.0 // indirect
github.com/txix-open/bellows v1.2.0 // indirect
github.com/txix-open/jsonschema v1.2.0 // indirect
github.com/txix-open/validator/v10 v10.0.0-20240401163703-e83541b40f99 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
- go.etcd.io/bbolt v1.3.11 // indirect
- go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.56.0 // indirect
- go.opentelemetry.io/otel v1.31.0 // indirect
- go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect
- go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 // indirect
- go.opentelemetry.io/otel/metric v1.31.0 // indirect
- go.opentelemetry.io/otel/sdk v1.31.0 // indirect
- go.opentelemetry.io/otel/trace v1.31.0 // indirect
- go.opentelemetry.io/proto/otlp v1.3.1 // indirect
+ go.etcd.io/bbolt v1.4.0 // indirect
+ go.opentelemetry.io/auto/sdk v1.1.0 // indirect
+ go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.60.0 // indirect
+ go.opentelemetry.io/otel v1.35.0 // indirect
+ go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 // indirect
+ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0 // indirect
+ go.opentelemetry.io/otel/metric v1.35.0 // indirect
+ go.opentelemetry.io/otel/sdk v1.35.0 // indirect
+ go.opentelemetry.io/otel/trace v1.35.0 // indirect
+ go.opentelemetry.io/proto/otlp v1.5.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
- golang.org/x/crypto v0.28.0 // indirect
- golang.org/x/net v0.30.0 // indirect
- golang.org/x/sys v0.26.0 // indirect
- golang.org/x/text v0.19.0 // indirect
- google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38 // indirect
- google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect
- google.golang.org/protobuf v1.35.1 // indirect
+ golang.org/x/crypto v0.36.0 // indirect
+ golang.org/x/net v0.37.0 // indirect
+ golang.org/x/sys v0.31.0 // indirect
+ golang.org/x/text v0.23.0 // indirect
+ google.golang.org/genproto/googleapis/api v0.0.0-20250311190419-81fb87f6b8bf // indirect
+ google.golang.org/genproto/googleapis/rpc v0.0.0-20250311190419-81fb87f6b8bf // indirect
+ google.golang.org/protobuf v1.36.5 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
-
-replace (
- github.com/armon/go-metrics => github.com/hashicorp/go-metrics v0.5.1
- golang.org/x/text => golang.org/x/text v0.3.8
-)
diff --git a/go.sum b/go.sum
index 0da77f1..658a184 100644
--- a/go.sum
+++ b/go.sum
@@ -1,3 +1,4 @@
+cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8afzqM=
github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10=
@@ -5,6 +6,7 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
+github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
@@ -26,9 +28,8 @@ github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp
github.com/coder/websocket v1.8.12 h1:5bUXkEPPIbewrnkU8LTCLVaxi4N4J8ahufH2vlo4NAo=
github.com/coder/websocket v1.8.12/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs=
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/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
@@ -36,16 +37,20 @@ github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
-github.com/gabriel-vasile/mimetype v1.4.6 h1:3+PzJTKLkvgjeTbts6msPJt4DixhT4YtFNf1gtGe3zc=
-github.com/gabriel-vasile/mimetype v1.4.6/go.mod h1:JX1qVKqZd40hUPpAfiNTe0Sne7hdfKSbOqqmkq8GCXc=
-github.com/getsentry/sentry-go v0.29.1 h1:DyZuChN8Hz3ARxGVV8ePaNXh1dQ7d76AiB117xcREwA=
-github.com/getsentry/sentry-go v0.29.1/go.mod h1:x3AtIzN01d6SiWkderzaH28Tm0lgkafpJ5Bm3li39O0=
+github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=
+github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=
+github.com/getsentry/sentry-go v0.31.1 h1:ELVc0h7gwyhnXHDouXkhqTFSO5oslsRDk0++eyE0KJ4=
+github.com/getsentry/sentry-go v0.31.1/go.mod h1:CYNcMMz73YigoHljQRG+qPF+eMq8gG72XcGN/p71BAY=
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
+github.com/go-faker/faker/v4 v4.6.0 h1:6aOPzNptRiDwD14HuAnEtlTa+D1IfFuEHO8+vEFwjTs=
+github.com/go-faker/faker/v4 v4.6.0/go.mod h1:ZmrHuVtTTm2Em9e0Du6CJ9CADaLEzGXW62z1YqFH0m0=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
+github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
+github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
@@ -57,8 +62,8 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
-github.com/go-resty/resty/v2 v2.15.3 h1:bqff+hcqAflpiF591hhJzNdkRsFhlB96CYfBwSFvql8=
-github.com/go-resty/resty/v2 v2.15.3/go.mod h1:0fHAoK7JoBy/Ch36N8VFeMsK7xQOHhvWaC3iOktwmIU=
+github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM=
+github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM=
github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
@@ -66,15 +71,27 @@ github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
+github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
+github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
+github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
+github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
+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.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
+github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
+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=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
-github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
-github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
+github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
+github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
-github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys=
-github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I=
+github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo=
+github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-hclog v0.9.1/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=
@@ -84,35 +101,39 @@ github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJ
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-metrics v0.5.1 h1:rfPwUqFU6uZXNvGl4hzjY8LEBsqFVU4si1H9/Hqck/U=
github.com/hashicorp/go-metrics v0.5.1/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE=
+github.com/hashicorp/go-metrics v0.5.4 h1:8mmPiIJkTPPEbAiV97IxdAGNdRdaWwVap1BU6elejKY=
+github.com/hashicorp/go-metrics v0.5.4/go.mod h1:CG5yz4NZ/AI/aQt9Ucm/vdBnbh7fvmv4lxZ350i+QQI=
github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-msgpack v1.1.5 h1:9byZdVjKTe5mce63pRVNP1L7UAmdHOTEMGehn6KvJWs=
github.com/hashicorp/go-msgpack v1.1.5/go.mod h1:gWVc3sv/wbDmR3rQsj1CAktEZzoz1YNK9NfGLXJ69/4=
-github.com/hashicorp/go-msgpack/v2 v2.1.2 h1:4Ee8FTp834e+ewB71RDrQ0VKpyFdrKOjvYtnQ/ltVj0=
-github.com/hashicorp/go-msgpack/v2 v2.1.2/go.mod h1:upybraOAblm4S7rx0+jeNy+CWWhzywQsSRV5033mMu4=
+github.com/hashicorp/go-msgpack/v2 v2.1.3 h1:cB1w4Zrk0O3jQBTcFMKqYQWRFfsSQ/TYKNyUUVyCP2c=
+github.com/hashicorp/go-msgpack/v2 v2.1.3/go.mod h1:SjlwKKFnwBXvxD/I1bEcfJIBbEJ+MCUn39TxymNR5ZU=
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
+github.com/hashicorp/go-uuid v1.0.0 h1:RS8zrF7PhGwyNPOtxSClXXj9HA8feRnJzgnI1RJCSnM=
github.com/hashicorp/go-uuid v1.0.0/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/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c=
github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/hashicorp/raft v1.1.0/go.mod h1:4Ak7FSPnuvmb0GV6vgIAJ4vYT4bek9bb6Q+7HVbyzqM=
-github.com/hashicorp/raft v1.7.1 h1:ytxsNx4baHsRZrhUcbt3+79zc4ly8qm7pi0393pSchY=
-github.com/hashicorp/raft v1.7.1/go.mod h1:hUeiEwQQR/Nk2iKDD0dkEhklSsu3jcAcqvPzPoZSAEM=
+github.com/hashicorp/raft v1.7.2 h1:pyvxhfJ4R8VIAlHKvLoKQWElZspsCVT6YWuxVxsPAgc=
+github.com/hashicorp/raft v1.7.2/go.mod h1:DfvCGFxpAUPE0L4Uc8JLlTPtc3GzSbdH0MTJCLgnmJQ=
github.com/hashicorp/raft-boltdb v0.0.0-20210409134258-03c10cc3d4ea/go.mod h1:qRd6nFJYYS6Iqnc/8HcUmko2/2Gw8qTFEmxDLii6W5I=
-github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
+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=
+github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
+github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
-github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
-github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
+github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
+github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
+github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
@@ -129,15 +150,14 @@ github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhR
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw=
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
-github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
-github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
+github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
+github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
-github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
-github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
+github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
+github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
-github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
@@ -155,6 +175,7 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
+github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
@@ -165,16 +186,17 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
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/pressly/goose/v3 v3.22.1 h1:2zICEfr1O3yTP9BRZMGPj7qFxQ+ik6yeo+z1LMuioLc=
-github.com/pressly/goose/v3 v3.22.1/go.mod h1:xtMpbstWyCpyH+0cxLTMCENWBG+0CSxvTsXhW95d5eo=
+github.com/pressly/goose/v3 v3.24.1 h1:bZmxRco2uy5uu5Ng1MMVEfYsFlrMJI+e/VMXHQ3C4LY=
+github.com/pressly/goose/v3 v3.24.1/go.mod h1:rEWreU9uVtt0DHCyLzF9gRcWiiTF/V+528DV+4DORug=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
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.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
-github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
+github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
+github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
+github.com/prometheus/client_golang v1.21.1 h1:DOvXXTqVzvkIewV/CDPFdejpMCGeMcbGCQ8YOmu+Ibk=
+github.com/prometheus/client_golang v1.21.1/go.mod h1:U9NM32ykUErtVBxdvD3zfi+EuFkkaBvMb09mIfe0Zgg=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
@@ -182,11 +204,15 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
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.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPAaSc=
-github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw=
+github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
+github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
+github.com/prometheus/common v0.62.0 h1:xasJaQlnWAeyHdUBeGjXmutelfJHWMRr+Fg4QszZ2Io=
+github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkqml0W5zIY1I=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/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=
+github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw=
@@ -195,22 +221,23 @@ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
-github.com/rqlite/go-sqlite3 v1.36.0 h1:dNW9Hn4v3HVVlO+q6QmQC5glZYIWFOzOWUjrKOxK3cE=
-github.com/rqlite/go-sqlite3 v1.36.0/go.mod h1:R9H7CatgYBt3c+fSV/5yo2vLh4ZjCB0aMHdkv69fP4A=
-github.com/rqlite/gorqlite v0.0.0-20241013203532-4385768ae85d h1:c88ius/WcN19inn14R+X2EQCFjjAu92txgdxNNnGxDI=
-github.com/rqlite/gorqlite v0.0.0-20241013203532-4385768ae85d/go.mod h1:xF/KoXmrRyahPfo5L7Szb5cAAUl53dMWBh9cMruGEZg=
+github.com/rqlite/go-sqlite3 v1.37.0 h1:7lA+Uitgo31OndqdgmSfplinZ+L+CAdsilLItjmYeW4=
+github.com/rqlite/go-sqlite3 v1.37.0/go.mod h1:R9H7CatgYBt3c+fSV/5yo2vLh4ZjCB0aMHdkv69fP4A=
+github.com/rqlite/gorqlite v0.0.0-20250128004930-114c7828b55a h1:9O8zgGrMBuTsnA3yyFd+JWhFSflQwzSUEB4AMnFHKhU=
+github.com/rqlite/gorqlite v0.0.0-20250128004930-114c7828b55a/go.mod h1:xF/KoXmrRyahPfo5L7Szb5cAAUl53dMWBh9cMruGEZg=
github.com/rqlite/raft-boltdb/v2 v2.0.0-20230523104317-c08e70f4de48 h1:NZ62M+kT0JqhyFUMc8I4SMmfmD4NGJxhb2ePJQXjryc=
github.com/rqlite/raft-boltdb/v2 v2.0.0-20230523104317-c08e70f4de48/go.mod h1:CRnsxgy5G8fAf5J+AM0yrsSdxXHKkIYOaq2sm+Q4DYc=
-github.com/rqlite/rqlite-disco-clients v0.0.0-20231230135307-118e35426347 h1:01eOG4AXjYsrsLRITgBFHaDPXys1NfeY2idx25ZJFF8=
-github.com/rqlite/rqlite-disco-clients v0.0.0-20231230135307-118e35426347/go.mod h1:pym85nj6JnCI7rM9RxTZ4cubkTQyyg7uLwVydso9B80=
-github.com/rqlite/rqlite/v8 v8.32.5 h1:wEzDX2HrGWMvFkg2fcCmi+rb1wQ1m5yEefUQfOMvMSY=
-github.com/rqlite/rqlite/v8 v8.32.5/go.mod h1:a1irqNWEZ+pWuWpgekbScCXp85QtNTJLarN3bVPjn9M=
-github.com/rqlite/sql v0.0.0-20241029220113-152a320b02f7 h1:Mnz6yd4FWtiD6bbH9WHFFHfrOM2OYTUTmwrsckRc4W8=
-github.com/rqlite/sql v0.0.0-20241029220113-152a320b02f7/go.mod h1:ib9zVtNgRKiGuoMyUqqL5aNpk+r+++YlyiVIkclVqPg=
+github.com/rqlite/rqlite-disco-clients v0.0.0-20250205044118-8ada2b350099 h1:5cqkVLdl6sGJSY3kiF2dqaA3bD+8OS5FUdZqO0BxXLU=
+github.com/rqlite/rqlite-disco-clients v0.0.0-20250205044118-8ada2b350099/go.mod h1:6SVI8KegsW9Fyu2UQ+uvw0JI5CAILRYRyiQ/OFSJPrs=
+github.com/rqlite/rqlite/v8 v8.36.12 h1:0wrsr0jAHp1dhPCjD/XxVqj/25Yq6GAWi4rz+R97yyY=
+github.com/rqlite/rqlite/v8 v8.36.12/go.mod h1:R+Kogxc9/d/Ns3+ZAg1ebk4MUOqK4vZbLBX83E8m6S4=
+github.com/rqlite/sql v0.0.0-20241111133259-a4122fabb196 h1:SjRKMwKLTEE3STO6unJlz4VlMjMv5NZgIdI9HikBeAc=
+github.com/rqlite/sql v0.0.0-20241111133259-a4122fabb196/go.mod h1:ib9zVtNgRKiGuoMyUqqL5aNpk+r+++YlyiVIkclVqPg=
github.com/sethvargo/go-retry v0.3.0 h1:EEt31A35QhrcRZtrYFDTBg91cqZVnFL2navjDrah2SE=
github.com/sethvargo/go-retry v0.3.0/go.mod h1:mNX17F0C/HguQMyMyJxcnU471gOZGxCLyYaFyAZraas=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
+github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
@@ -223,24 +250,24 @@ 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/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
-github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
+github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
+github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
+github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
-github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
-github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/txix-open/bellows v1.2.0 h1:CXv8nQaZtB/micraeRilYyj/gtfv+bqBgP5aPYQgjeY=
github.com/txix-open/bellows v1.2.0/go.mod h1:qbKCy+RTgD30Qpw1fyb3y3jp5Y9mGhLLxgae1l0W92o=
github.com/txix-open/etp/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIgA=
github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8=
-github.com/txix-open/grmq v1.6.0 h1:V4QRb0sI2CMfdMaMsFGvGvUIDGad5vr3khNU7A3LlP8=
-github.com/txix-open/grmq v1.6.0/go.mod h1:s+NNNv42+32yLpjvl2tpqtyBbMB9e7kKFee3lfa/dyo=
-github.com/txix-open/isp-kit v1.39.2 h1:2L2LFwi+sNop9NeLDQ4scIy8LuohzXh4EBejHApAeDM=
-github.com/txix-open/isp-kit v1.39.2/go.mod h1:xB6mkoOewZBI1ND8kjU5TR6kvLu3VQI3Rdkh6g6FE4I=
+github.com/txix-open/grmq v1.7.0 h1:nwenrlxEjXpK0EBCa/WbIxK+y0mF2pZxNKbheFjQVsI=
+github.com/txix-open/grmq v1.7.0/go.mod h1:DAfbV4jLyxQBLG8OYJVy8kCbhucdlu/C/wl+nUDc9p8=
+github.com/txix-open/isp-kit v1.45.0 h1:GPrr4F5SLQsrXgUTCqHL7C90vygjmNPOimUCAuXr2dw=
+github.com/txix-open/isp-kit v1.45.0/go.mod h1:efg4qDdAuw9Doi1OoT+OYSbr34B3j9u2ubz9R5BXYto=
github.com/txix-open/jsonschema v1.2.0 h1:B8TrdSsPhDvYv67oi/LVqf7/+PuqFlMsNwUzGeHfl1s=
github.com/txix-open/jsonschema v1.2.0/go.mod h1:l8YDZ1nvJrw6uxWowSVOxCV/ebiMJyapffW87ZEqH00=
github.com/txix-open/validator/v10 v10.0.0-20240401163703-e83541b40f99 h1:Z0Sqf+U+Sc6hfIXtRCIZlbJprkCjwMFbS4ZbEPQ44To=
@@ -256,26 +283,30 @@ github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
-go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0=
-go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I=
-go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.56.0 h1:4BZHA+B1wXEQoGNHxW8mURaLhcdGwvRnmhGbm+odRbc=
-go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.56.0/go.mod h1:3qi2EEwMgB4xnKgPLqsDP3j9qxnHDZeHsnAxfjQqTko=
-go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s=
-go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM=
-go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY=
-go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 h1:K0XaT3DwHAcV4nKLzcQvwAgSyisUghWoY20I7huthMk=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0/go.mod h1:B5Ki776z/MBnVha1Nzwp5arlzBbE3+1jk+pGmaP5HME=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 h1:lUsI2TYsQw2r1IASwoROaCnjdj2cvC2+Jbxvk6nHnWU=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0/go.mod h1:2HpZxxQurfGxJlJDblybejHB6RX6pmExPNe517hREw4=
-go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE=
-go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY=
-go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk=
-go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0=
-go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys=
-go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A=
-go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0=
-go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8=
+go.etcd.io/bbolt v1.4.0 h1:TU77id3TnN/zKr7CO/uk+fBCwF2jGcMuw2B/FMAzYIk=
+go.etcd.io/bbolt v1.4.0/go.mod h1:AsD+OCi/qPN1giOX1aiLAha3o1U8rAz65bvN4j0sRuk=
+go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
+go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
+go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.60.0 h1:0tY123n7CdWMem7MOVdKOt0YfshufLCwfE5Bob+hQuM=
+go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.60.0/go.mod h1:CosX/aS4eHnG9D7nESYpV753l4j9q5j3SL/PUYd2lR8=
+go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 h1:sbiXRNDSWJOTobXh5HyQKjq6wUC5tNybqjIqDpAY4CU=
+go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0/go.mod h1:69uWxva0WgAA/4bu2Yy70SLDBwZXuQ6PbBpbsa5iZrQ=
+go.opentelemetry.io/otel v1.35.0 h1:xKWKPxrxB6OtMCbmMY021CqC45J+3Onta9MqjhnusiQ=
+go.opentelemetry.io/otel v1.35.0/go.mod h1:UEqy8Zp11hpkUrL73gSlELM0DupHoiq72dR+Zqel/+Y=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 h1:1fTNlAIJZGWLP5FVu0fikVry1IsiUnXjf7QFvoNN3Xw=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0/go.mod h1:zjPK58DtkqQFn+YUMbx0M2XV3QgKU0gS9LeGohREyK4=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0 h1:xJ2qHD0C1BeYVTLLR9sX12+Qb95kfeD/byKj6Ky1pXg=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0/go.mod h1:u5BF1xyjstDowA1R5QAO9JHzqK+ublenEW/dyqTjBVk=
+go.opentelemetry.io/otel/metric v1.35.0 h1:0znxYu2SNyuMSQT4Y9WDWej0VpcsxkuklLa4/siN90M=
+go.opentelemetry.io/otel/metric v1.35.0/go.mod h1:nKVFgxBZ2fReX6IlyW28MgZojkoAkJGaE8CpgeAU3oE=
+go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY=
+go.opentelemetry.io/otel/sdk v1.35.0/go.mod h1:+ga1bZliga3DxJ3CQGg3updiaAJoNECOgJREo9KHGQg=
+go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk=
+go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w=
+go.opentelemetry.io/otel/trace v1.35.0 h1:dPpEfJu1sDIqruz7BHFG3c7528f6ddfSWfFDVt/xgMs=
+go.opentelemetry.io/otel/trace v1.35.0/go.mod h1:WUk7DtFp1Aw2MkvqGdwiXYDZZNvA/1J8o6xRXLrIkyc=
+go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4=
+go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
@@ -284,44 +315,57 @@ go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
-golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
-golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
+golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
+golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
+golang.org/x/net v0.0.0-20180724234803-3673e40ba225/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-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
-golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
-golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
+golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=
+golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
+golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
-golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
+golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
+golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
-golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
+golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
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=
golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
@@ -331,14 +375,22 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38 h1:2oV8dfuIkM1Ti7DwXc0BJfnwr9csz4TDXI9EmiI+Rbw=
-google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38/go.mod h1:vuAjtvlwkDKF6L1GQ0SokiRLCGFfeBUXWr/aFFkHACc=
-google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 h1:zciRKQ4kBpFgpfC5QQCVtnnNAcLIqweL7plyZRQHVpI=
-google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
-google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
-google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
-google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
-google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
+google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/genproto/googleapis/api v0.0.0-20250311190419-81fb87f6b8bf h1:BdIVRm+fyDUn8lrZLPSlBCfM/YKDwUBYgDoLv9+DYo0=
+google.golang.org/genproto/googleapis/api v0.0.0-20250311190419-81fb87f6b8bf/go.mod h1:jbe3Bkdp+Dh2IrslsFCklNhweNTBgSYanP1UXhJDhKg=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20250311190419-81fb87f6b8bf h1:dHDlF3CWxQkefK9IJx+O8ldY0gLygvrlYRBNbPqDWuY=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20250311190419-81fb87f6b8bf/go.mod h1:LuRYeWDFV6WOn90g357N17oMCaxpgCnbi/44qJvDn2I=
+google.golang.org/grpc v1.71.0 h1:kF77BGdPTQ4/JZWMlb9VpJ5pa25aqvVqogsxNHHdeBg=
+google.golang.org/grpc v1.71.0/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec=
+google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
+google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
+google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
+google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
+google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
+google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
+google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
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-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
@@ -350,17 +402,20 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 h1:5D53IMaUuA5InSeMu9eJtlQXS2NxAhyWQvkKEgXZhHI=
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6/go.mod h1:Qz0X07sNOR1jWYCrJMEnbW/X55x206Q7Vt4mz6/wHp4=
+modernc.org/libc v1.55.3 h1:AzcW1mhlPNrRtjS5sS+eW2ISCgSOLLNyFzRh/V3Qj/U=
+modernc.org/libc v1.55.3/go.mod h1:qFXepLhz+JjFThQ4kzwzOjA/y/artDeg+pcYnY+Q83w=
modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4=
modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo=
modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E=
modernc.org/memory v1.8.0/go.mod h1:XPZ936zp5OMKGWPqbD3JShgd/ZoQ7899TUuQqxY+peU=
-modernc.org/sqlite v1.33.0 h1:WWkA/T2G17okiLGgKAj4/RMIvgyMT19yQ038160IeYk=
-modernc.org/sqlite v1.33.0/go.mod h1:9uQ9hF/pCZoYZK73D/ud5Z7cIRIILSZI8NdIemVMTX8=
+modernc.org/sqlite v1.34.1 h1:u3Yi6M0N8t9yKRDwhXcyp1eS5/ErhPTBggxWFuR6Hfk=
+modernc.org/sqlite v1.34.1/go.mod h1:pXV2xHxhzXZsgT/RtTFAPY6JJDEvOTcTdwADQCCWD4k=
modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA=
modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0=
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
diff --git a/migrations/20250303125608_add_variables.sql b/migrations/20250303125608_add_variables.sql
new file mode 100644
index 0000000..ce4d7d6
--- /dev/null
+++ b/migrations/20250303125608_add_variables.sql
@@ -0,0 +1,26 @@
+-- +goose Up
+-- +goose NO TRANSACTION
+create table isp_config_service__variable
+(
+ name text primary key,
+ description text not null,
+ type text not null,
+ value text not null,
+ created_at integer not null default (unixepoch()),
+ updated_at integer not null default (unixepoch())
+);
+
+create table isp_config_service__config_has_variable
+(
+ config_id text not null,
+ variable_name text not null,
+ primary key (config_id, variable_name),
+ foreign key (config_id) references isp_config_service__config (id) on delete cascade on update cascade,
+ foreign key (variable_name) references isp_config_service__variable (name)
+);
+
+create index IX_isp_config_service__config_has_variable__variable_name on isp_config_service__config_has_variable (variable_name);
+
+-- +goose Down
+drop table isp_config_service__config_has_variable;
+drop table isp_config_service__variable;
\ No newline at end of file
diff --git a/repository/config.go b/repository/config.go
index 0192a91..365ad7f 100644
--- a/repository/config.go
+++ b/repository/config.go
@@ -2,7 +2,7 @@ package repository
import (
"context"
-
+ "fmt"
"github.com/Masterminds/squirrel"
"github.com/pkg/errors"
"isp-config-service/entity"
@@ -170,3 +170,30 @@ func (r Config) SetActive(ctx context.Context, configId string, active xtypes.Bo
return nil
}
+
+func (r Config) GetMetaByVariables(ctx context.Context, variables []string) (map[string][]entity.ConfigMetaWithVariable, error) {
+ ctx = sql_metrics.OperationLabelToContext(ctx, "Config.GetMetaByVariables")
+
+ query, args, err := squirrel.Select("c.id", "c.name", "c.module_id", "c.active", "l.variable_name").
+ From(Table("config c")).
+ Join(fmt.Sprintf("%s l on c.id = l.config_id", Table("config_has_variable"))).
+ Where(squirrel.Eq{
+ "l.variable_name": variables,
+ }).ToSql()
+ if err != nil {
+ return nil, errors.WithMessage(err, "build query")
+ }
+
+ list := make([]entity.ConfigMetaWithVariable, 0)
+ err = r.db.Select(ctx, &list, query, args...)
+ if err != nil {
+ return nil, errors.WithMessagef(err, "select: %s", query)
+ }
+
+ result := make(map[string][]entity.ConfigMetaWithVariable)
+ for _, variable := range list {
+ result[variable.VariableName] = append(result[variable.VariableName], variable)
+ }
+
+ return result, nil
+}
diff --git a/repository/variable.go b/repository/variable.go
new file mode 100644
index 0000000..a935e35
--- /dev/null
+++ b/repository/variable.go
@@ -0,0 +1,188 @@
+package repository
+
+import (
+ "context"
+ "database/sql"
+ "fmt"
+ "github.com/Masterminds/squirrel"
+ "github.com/pkg/errors"
+ "isp-config-service/entity"
+ "isp-config-service/middlewares/sql_metrics"
+ "isp-config-service/service/rqlite/db"
+ "strings"
+)
+
+type Variable struct {
+ db db.DB
+}
+
+func NewVariable(db db.DB) Variable {
+ return Variable{
+ db: db,
+ }
+}
+
+func (r Variable) All(ctx context.Context) ([]entity.Variable, error) {
+ ctx = sql_metrics.OperationLabelToContext(ctx, "Variable.All")
+
+ result := make([]entity.Variable, 0)
+ query := fmt.Sprintf("SELECT * FROM %s order by created_at desc", Table("variable"))
+ err := r.db.Select(ctx, &result, query)
+ if err != nil {
+ return nil, errors.WithMessagef(err, "select: %s", query)
+ }
+ return result, nil
+}
+
+func (r Variable) GetByName(ctx context.Context, name string) (*entity.Variable, error) {
+ ctx = sql_metrics.OperationLabelToContext(ctx, "Variable.GetByName")
+
+ query, args, err := squirrel.Select("*").
+ From(Table("variable")).
+ Where(squirrel.Eq{"name": name}).
+ ToSql()
+ if err != nil {
+ return nil, errors.WithMessage(err, "build query")
+ }
+
+ result := entity.Variable{}
+ err = r.db.SelectRow(ctx, &result, query, args...)
+ if errors.Is(err, sql.ErrNoRows) {
+ return nil, nil //nolint:nilnil
+ }
+ if err != nil {
+ return nil, errors.WithMessagef(err, "select: %s", query)
+ }
+ return &result, nil
+}
+
+func (r Variable) Insert(ctx context.Context, variable entity.Variable) error {
+ ctx = sql_metrics.OperationLabelToContext(ctx, "Variable.Insert")
+
+ query, args, err := squirrel.Insert(Table("variable")).
+ Columns("name", "description", "type", "value").
+ Values(variable.Name, variable.Description, variable.Type, variable.Value).
+ ToSql()
+ if err != nil {
+ return errors.WithMessage(err, "build query")
+ }
+
+ _, err = r.db.Exec(ctx, query, args...)
+ if err != nil {
+ if strings.Contains(err.Error(), "UNIQUE constraint failed") {
+ return entity.ErrVariableAlreadyExists
+ }
+ return errors.WithMessagef(err, "exec: %s", query)
+ }
+
+ return nil
+}
+
+func (r Variable) Update(ctx context.Context, variable entity.Variable) (bool, error) {
+ ctx = sql_metrics.OperationLabelToContext(ctx, "Variable.Update")
+
+ query, args, err := squirrel.Update(Table("variable")).
+ SetMap(map[string]any{
+ "description": variable.Description,
+ "value": variable.Value,
+ "updated_at": squirrel.Expr("unixepoch()"),
+ }).Where(squirrel.Eq{
+ "name": variable.Name,
+ }).ToSql()
+ if err != nil {
+ return false, errors.WithMessage(err, "build query")
+ }
+
+ result, err := r.db.Exec(ctx, query, args...)
+ if err != nil {
+ return false, errors.WithMessagef(err, "exec: %s", query)
+ }
+
+ affected, err := result.RowsAffected()
+ if err != nil {
+ return false, errors.WithMessage(err, "get rows affected")
+ }
+ return affected > 0, nil
+}
+
+func (r Variable) Upsert(ctx context.Context, variables []entity.Variable) error {
+ ctx = sql_metrics.OperationLabelToContext(ctx, "Variable.Upsert")
+
+ requests := make([][]any, 0, len(variables))
+ for _, variable := range variables {
+ query, args, err := squirrel.Insert(Table("variable")).
+ Columns("name", "description", "type", "value").
+ Values(variable.Name, variable.Description, variable.Type, variable.Value).
+ Suffix(`on conflict (name) do update
+ set description = excluded.description,
+ type = excluded.type,
+ value = excluded.value,
+ updated_at = unixepoch()`,
+ ).ToSql()
+ if err != nil {
+ return errors.WithMessage(err, "build query")
+ }
+ requests = append(requests, db.Request(query, args...))
+ }
+
+ _, err := r.db.ExecTransaction(ctx, requests)
+ if err != nil {
+ return errors.WithMessagef(err, "exec transaction: %v", requests)
+ }
+
+ return nil
+}
+
+func (r Variable) UpsertLinks(ctx context.Context, configId string, links []entity.ConfigHasVariable) error {
+ ctx = sql_metrics.OperationLabelToContext(ctx, "Variable.UpsertLinks")
+
+ deleteQuery, args, err := squirrel.Delete(Table("config_has_variable")).Where(squirrel.Eq{
+ "config_id": configId,
+ }).ToSql()
+ if err != nil {
+ return errors.WithMessage(err, "build delete query")
+ }
+ requests := [][]any{
+ db.Request(deleteQuery, args...),
+ }
+ for _, variable := range links {
+ query, args, err := squirrel.Insert(Table("config_has_variable")).
+ Columns("config_id", "variable_name").
+ Values(variable.ConfigId, variable.VariableName).
+ ToSql()
+ if err != nil {
+ return errors.WithMessage(err, "build query")
+ }
+ requests = append(requests, db.Request(query, args...))
+ }
+
+ _, err = r.db.ExecTransaction(ctx, requests)
+ if err != nil {
+ return errors.WithMessagef(err, "exec transaction: %v", requests)
+ }
+
+ return nil
+}
+
+func (r Variable) Delete(ctx context.Context, name string) (bool, error) {
+ ctx = sql_metrics.OperationLabelToContext(ctx, "Variable.Delete")
+
+ query, args, err := squirrel.Delete(Table("variable")).
+ Where(squirrel.Eq{
+ "name": name,
+ }).ToSql()
+ if err != nil {
+ return false, errors.WithMessage(err, "build query")
+ }
+
+ result, err := r.db.Exec(ctx, query, args...)
+ if err != nil {
+ return false, errors.WithMessagef(err, "exec: %s", query)
+ }
+
+ affected, err := result.RowsAffected()
+ if err != nil {
+ return false, errors.WithMessage(err, "get rows affected")
+ }
+ return affected > 0, nil
+}
diff --git a/routes/routes.go b/routes/routes.go
index 40c6368..b31a987 100644
--- a/routes/routes.go
+++ b/routes/routes.go
@@ -20,6 +20,7 @@ type Controllers struct {
ConfigApi api.Config
ConfigHistoryApi api.ConfigHistory
ConfigSchemaApi api.ConfigSchema
+ VariableApi api.Variable
}
func EndpointDescriptors() []cluster.EndpointDescriptor {
@@ -63,53 +64,84 @@ func HttpHandler(etpSrv *etp.Server, conf conf.Local, rqliteProxy http.Handler)
}
func endpointDescriptors(c Controllers) []cluster.EndpointDescriptor {
- return []cluster.EndpointDescriptor{{
- Path: "config/module/get_modules_info",
- Inner: true,
- Handler: c.ModuleApi.Status,
- }, {
- Path: "config/module/delete_module",
- Inner: true,
- Handler: c.ModuleApi.DeleteModule,
- }, {
- Path: "config/routing/get_routes",
- Inner: true,
- Handler: c.ModuleApi.Connections,
- }, {
- Path: "config/config/get_active_config_by_module_name",
- Inner: true,
- Handler: c.ConfigApi.GetActiveConfigByModuleName,
- }, {
- Path: "config/config/get_configs_by_module_id",
- Inner: true,
- Handler: c.ConfigApi.GetConfigsByModuleId,
- }, {
- Path: "config/config/create_update_config",
- Inner: true,
- Handler: c.ConfigApi.CreateUpdateConfig,
- }, {
- Path: "config/config/get_config_by_id",
- Inner: true,
- Handler: c.ConfigApi.GetConfigById,
- }, {
- Path: "config/config/mark_config_as_active",
- Inner: true,
- Handler: c.ConfigApi.MarkConfigAsActive,
- }, {
- Path: "config/config/delete_config",
- Inner: true,
- Handler: c.ConfigApi.DeleteConfigs,
- }, {
- Path: "config/config/get_all_version",
- Inner: true,
- Handler: c.ConfigHistoryApi.GetAllVersion,
- }, {
- Path: "config/config/delete_version",
- Inner: true,
- Handler: c.ConfigHistoryApi.DeleteConfigVersion,
- }, {
- Path: "config/schema/get_by_module_id",
- Inner: true,
- Handler: c.ConfigSchemaApi.SchemaByModuleId,
- }}
+ return []cluster.EndpointDescriptor{
+ // modules
+ {
+ Path: "config/module/get_modules_info",
+ Inner: true,
+ Handler: c.ModuleApi.Status,
+ }, {
+ Path: "config/module/delete_module",
+ Inner: true,
+ Handler: c.ModuleApi.DeleteModule,
+ }, {
+ Path: "config/routing/get_routes",
+ Inner: true,
+ Handler: c.ModuleApi.Connections,
+ },
+ // configs
+ {
+ Path: "config/config/get_active_config_by_module_name",
+ Inner: true,
+ Handler: c.ConfigApi.GetActiveConfigByModuleName,
+ }, {
+ Path: "config/config/get_configs_by_module_id",
+ Inner: true,
+ Handler: c.ConfigApi.GetConfigsByModuleId,
+ }, {
+ Path: "config/config/create_update_config",
+ Inner: true,
+ Handler: c.ConfigApi.CreateUpdateConfig,
+ }, {
+ Path: "config/config/get_config_by_id",
+ Inner: true,
+ Handler: c.ConfigApi.GetConfigById,
+ }, {
+ Path: "config/config/mark_config_as_active",
+ Inner: true,
+ Handler: c.ConfigApi.MarkConfigAsActive,
+ }, {
+ Path: "config/config/delete_config",
+ Inner: true,
+ Handler: c.ConfigApi.DeleteConfigs,
+ }, {
+ Path: "config/config/get_all_version",
+ Inner: true,
+ Handler: c.ConfigHistoryApi.GetAllVersion,
+ }, {
+ Path: "config/config/delete_version",
+ Inner: true,
+ Handler: c.ConfigHistoryApi.DeleteConfigVersion,
+ }, {
+ Path: "config/schema/get_by_module_id",
+ Inner: true,
+ Handler: c.ConfigSchemaApi.SchemaByModuleId,
+ },
+ // variables
+ {
+ Path: "config/variable/all",
+ Inner: true,
+ Handler: c.VariableApi.All,
+ }, {
+ Path: "config/variable/get_by_name",
+ Inner: true,
+ Handler: c.VariableApi.GetByName,
+ }, {
+ Path: "config/variable/create",
+ Inner: true,
+ Handler: c.VariableApi.Create,
+ }, {
+ Path: "config/variable/update",
+ Inner: true,
+ Handler: c.VariableApi.Update,
+ }, {
+ Path: "config/variable/upsert",
+ Inner: true,
+ Handler: c.VariableApi.Upsert,
+ }, {
+ Path: "config/variable/delete",
+ Inner: true,
+ Handler: c.VariableApi.Delete,
+ },
+ }
}
diff --git a/service/api/config.go b/service/api/config.go
index 1ac29c5..fb43cff 100644
--- a/service/api/config.go
+++ b/service/api/config.go
@@ -30,12 +30,18 @@ type ConfigHistoryService interface {
OnUpdateConfig(ctx context.Context, oldConfig entity.Config) error
}
+type VariableService interface {
+ ExtractVariables(ctx context.Context, configId string, input []byte) (*domain.VariableExtractionResult, error)
+ SaveVariableLinks(ctx context.Context, configId string, links []entity.ConfigHasVariable) error
+}
+
type Config struct {
configRepo ConfigRepo
moduleRepo ModuleRepo
schemaRepo SchemaRepo
eventRepo EventRepo
configHistoryService ConfigHistoryService
+ variableService VariableService
}
func NewConfig(
@@ -44,6 +50,7 @@ func NewConfig(
schemaRepo SchemaRepo,
eventRepo EventRepo,
configHistoryService ConfigHistoryService,
+ variableService VariableService,
) Config {
return Config{
configRepo: configRepo,
@@ -51,6 +58,7 @@ func NewConfig(
schemaRepo: schemaRepo,
eventRepo: eventRepo,
configHistoryService: configHistoryService,
+ variableService: variableService,
}
}
@@ -118,6 +126,11 @@ func (c Config) CreateUpdateConfig(
return c.insertNewConfig(ctx, adminId, req)
}
+ variableExtractionResult, err := c.extractAndCheckVariables(ctx, req.Id, req.Data)
+ if err != nil {
+ return nil, errors.WithMessage(err, "extract variables")
+ }
+
oldConfig, err := c.configRepo.GetById(ctx, req.Id)
if err != nil {
return nil, errors.WithMessage(err, "get old config")
@@ -146,6 +159,11 @@ func (c Config) CreateUpdateConfig(
return nil, errors.WithMessage(err, "change config history")
}
+ err = c.variableService.SaveVariableLinks(ctx, config.Id, variableExtractionResult.VariableLinks)
+ if err != nil {
+ return nil, errors.WithMessage(err, "save variable links")
+ }
+
if oldConfig.Active {
err = c.emitChangeActiveConfigEvent(ctx, oldConfig.ModuleId)
if err != nil {
@@ -236,10 +254,35 @@ func (c Config) insertNewConfig(ctx context.Context, adminId int, req domain.Cre
if err != nil {
return nil, errors.WithMessage(err, "insert new config")
}
+
+ extractResult, err := c.extractAndCheckVariables(ctx, config.Id, config.Data)
+ if err != nil {
+ return nil, err
+ }
+ err = c.variableService.SaveVariableLinks(ctx, config.Id, extractResult.VariableLinks)
+ if err != nil {
+ return nil, errors.WithMessage(err, "save variable links")
+ }
+
result := configToDto(config, nil)
return &result, nil
}
+func (c Config) extractAndCheckVariables(ctx context.Context, configId string, input []byte) (*domain.VariableExtractionResult, error) {
+ variableExtractionResult, err := c.variableService.ExtractVariables(ctx, configId, input)
+ if err != nil {
+ return nil, errors.WithMessage(err, "extract variables")
+ }
+ if len(variableExtractionResult.AbsentVariables) > 0 {
+ details := make(map[string]string)
+ for _, variable := range variableExtractionResult.AbsentVariables {
+ details[variable] = "variable is not defined"
+ }
+ return nil, domain.NewConfigValidationError(details)
+ }
+ return variableExtractionResult, nil
+}
+
func (c Config) validateConfigUpdate(ctx context.Context, moduleId string, configData []byte) error {
schema, err := c.schemaRepo.GetByModuleId(ctx, moduleId)
if err != nil {
diff --git a/service/module/service.go b/service/module/service.go
index 115d46c..d10baa1 100644
--- a/service/module/service.go
+++ b/service/module/service.go
@@ -10,9 +10,11 @@ import (
"github.com/txix-open/etp/v4/store"
"github.com/txix-open/isp-kit/cluster"
"github.com/txix-open/isp-kit/log"
+ "isp-config-service/domain"
"isp-config-service/entity"
"isp-config-service/entity/xtypes"
"isp-config-service/helpers"
+ "strings"
)
const (
@@ -42,6 +44,12 @@ type ConfigRepo interface {
GetActive(ctx context.Context, moduleId string) (*entity.Config, error)
}
+type VariableService interface {
+ RenderConfig(ctx context.Context, input []byte) ([]byte, error)
+ ExtractVariables(ctx context.Context, configId string, input []byte) (*domain.VariableExtractionResult, error)
+ SaveVariableLinks(ctx context.Context, configId string, links []entity.ConfigHasVariable) error
+}
+
type SubscriptionService interface {
SubscribeToConfigChanges(conn *etp.Conn, moduleId string)
SubscribeToBackendsChanges(ctx context.Context, conn *etp.Conn, requiredModuleNames []string) error
@@ -55,6 +63,7 @@ type Service struct {
configSchemaRepo ConfigSchemaRepo
subscriptionService SubscriptionService
emitter Emitter
+ variableService VariableService
logger log.Logger
}
@@ -65,6 +74,7 @@ func NewService(
configSchemaRepo ConfigSchemaRepo,
subscriptionService SubscriptionService,
emitter Emitter,
+ variableService VariableService,
logger log.Logger,
) Service {
return Service{
@@ -74,6 +84,7 @@ func NewService(
configSchemaRepo: configSchemaRepo,
subscriptionService: subscriptionService,
emitter: emitter,
+ variableService: variableService,
logger: logger,
}
}
@@ -213,10 +224,27 @@ func (s Service) OnModuleConfigSchema(
if err != nil {
return errors.WithMessage(err, "insert config in store")
}
+
+ result, err := s.variableService.ExtractVariables(ctx, initialConfig.Id, initialConfig.Data)
+ if err != nil {
+ return errors.WithMessage(err, "extract and save variable links in store")
+ }
+ if len(result.AbsentVariables) > 0 {
+ return errors.Errorf("missing variables in initial config: [%s]", strings.Join(result.AbsentVariables, ","))
+ }
+ err = s.variableService.SaveVariableLinks(ctx, initialConfig.Id, result.VariableLinks)
+ if err != nil {
+ return errors.WithMessage(err, "save variable links in store")
+ }
+
config = &initialConfig
}
- s.emitter.Emit(ctx, conn, cluster.ConfigSendConfigWhenConnected, config.Data)
+ configData, err := s.variableService.RenderConfig(ctx, config.Data)
+ if err != nil {
+ return errors.WithMessage(err, "render config")
+ }
+ s.emitter.Emit(ctx, conn, cluster.ConfigSendConfigWhenConnected, configData)
s.subscriptionService.SubscribeToConfigChanges(conn, moduleId)
diff --git a/service/rqlite/db/db.go b/service/rqlite/db/db.go
index 9097d1e..1edfa8c 100644
--- a/service/rqlite/db/db.go
+++ b/service/rqlite/db/db.go
@@ -32,7 +32,7 @@ func (d Adapter) Select(ctx context.Context, ptr any, query string, args ...any)
result := &Result{
Rows: ptr,
}
- resp := Response{
+ resp := &Response{
Results: []*Result{result},
}
params := map[string]any{
@@ -42,22 +42,24 @@ func (d Adapter) Select(ctx context.Context, ptr any, query string, args ...any)
consistencyFromContext(ctx).appendParams(params)
err := d.cli.Post("/db/query").
QueryParams(params).
- JsonRequestBody(requests(request(query, args...))).
- JsonResponseBody(&resp).
+ JsonRequestBody(Requests(Request(query, args...))).
+ JsonResponseBody(resp).
StatusCodeToError().
DoWithoutResponse(ctx)
if err != nil {
return errors.WithMessage(err, "call rqlite")
}
- if result.Error != "" {
- return errors.Errorf("sqlite: %s", result.Error)
+ err = catchError(resp, result)
+ if err != nil {
+ return err
}
+
return nil
}
func (d Adapter) SelectRow(ctx context.Context, ptr any, query string, args ...any) error {
result := &Result{}
- resp := Response{
+ resp := &Response{
Results: []*Result{result},
}
params := map[string]any{
@@ -67,8 +69,8 @@ func (d Adapter) SelectRow(ctx context.Context, ptr any, query string, args ...a
consistencyFromContext(ctx).appendParams(params)
httpResp, err := d.cli.Post("/db/request").
QueryParams(params).
- JsonRequestBody(requests(request(query, args...))).
- JsonResponseBody(&resp).
+ JsonRequestBody(Requests(Request(query, args...))).
+ JsonResponseBody(resp).
StatusCodeToError().
Do(ctx)
if err != nil {
@@ -76,8 +78,9 @@ func (d Adapter) SelectRow(ctx context.Context, ptr any, query string, args ...a
}
defer httpResp.Close()
- if result.Error != "" {
- return errors.Errorf("sqlite: %s", result.Error)
+ err = catchError(resp, result)
+ if err != nil {
+ return err
}
body, _ := httpResp.Body()
@@ -95,26 +98,68 @@ func (d Adapter) SelectRow(ctx context.Context, ptr any, query string, args ...a
}
func (d Adapter) Exec(ctx context.Context, query string, args ...any) (sql.Result, error) {
- result := &Result{}
- resp := Response{
- Results: []*Result{result},
- }
- err := d.cli.Post("/db/execute").
- QueryParams(map[string]any{
- "timings": true,
- }).JsonRequestBody(requests(request(query, args...))).
- JsonResponseBody(&resp).
- StatusCodeToError().
- DoWithoutResponse(ctx)
+ results, err := d.exec(ctx, false, Requests(Request(query, args...)))
if err != nil {
- return nil, errors.WithMessage(err, "call rqlite")
+ return nil, err
}
- if result.Error != "" {
- return nil, errors.Errorf("sqlite: %s", result.Error)
+
+ if len(results) == 0 {
+ return nil, errors.Errorf("unexpected empty results")
}
+ result, ok := results[0].(*Result)
+ if !ok {
+ return nil, errors.Errorf("unexpected result type: %T", results[0])
+ }
+ err = catchError(nil, result)
+ if err != nil {
+ return nil, err
+ }
+
return result, nil
}
func (d Adapter) ExecNamed(ctx context.Context, query string, arg any) (sql.Result, error) {
return d.Exec(ctx, query, arg)
}
+
+func (d Adapter) ExecTransaction(ctx context.Context, requests [][]any) ([]sql.Result, error) {
+ return d.exec(ctx, true, requests)
+}
+
+func (d Adapter) exec(ctx context.Context, inTx bool, requests [][]any) ([]sql.Result, error) {
+ resp := &Response{
+ Results: []*Result{},
+ }
+ err := d.cli.Post("/db/execute").
+ QueryParams(map[string]any{
+ "timings": true,
+ "transaction": inTx,
+ }).JsonRequestBody(requests).
+ JsonResponseBody(resp).
+ StatusCodeToError().
+ DoWithoutResponse(ctx)
+ if err != nil {
+ return nil, errors.WithMessage(err, "call rqlite")
+ }
+ err = catchError(resp, nil)
+ if err != nil {
+ return nil, err
+ }
+
+ results := make([]sql.Result, 0, len(requests))
+ for _, result := range resp.Results {
+ results = append(results, result)
+ }
+
+ return results, nil
+}
+
+func catchError(resp *Response, result *Result) error {
+ if resp != nil && resp.Error != "" {
+ return errors.Errorf("rqlite api: %s", resp.Error)
+ }
+ if result != nil && result.Error != "" {
+ return errors.Errorf("sqlite: %s", result.Error)
+ }
+ return nil
+}
diff --git a/service/rqlite/db/iface.go b/service/rqlite/db/iface.go
index 1626c76..5ceb2a7 100644
--- a/service/rqlite/db/iface.go
+++ b/service/rqlite/db/iface.go
@@ -10,4 +10,5 @@ type DB interface {
SelectRow(ctx context.Context, ptr any, query string, args ...any) error
Exec(ctx context.Context, query string, args ...any) (sql.Result, error)
ExecNamed(ctx context.Context, query string, arg any) (sql.Result, error)
+ ExecTransaction(ctx context.Context, requests [][]any) ([]sql.Result, error)
}
diff --git a/service/rqlite/db/request.go b/service/rqlite/db/request.go
index 789868c..5560ede 100644
--- a/service/rqlite/db/request.go
+++ b/service/rqlite/db/request.go
@@ -1,9 +1,9 @@
package db
-func request(query string, args ...any) []any {
+func Request(query string, args ...any) []any {
return append([]any{query}, args...)
}
-func requests(requests ...[]any) [][]any {
+func Requests(requests ...[]any) [][]any {
return requests
}
diff --git a/service/rqlite/db/result.go b/service/rqlite/db/result.go
index 0af161f..2370a1c 100644
--- a/service/rqlite/db/result.go
+++ b/service/rqlite/db/result.go
@@ -20,4 +20,5 @@ func (r Result) RowsAffected() (int64, error) {
type Response struct {
Results []*Result `json:"results"`
Time float64 `json:"time"`
+ Error string `json:"error"`
}
diff --git a/service/startup/service.go b/service/startup/service.go
index 028a517..ed143f7 100644
--- a/service/startup/service.go
+++ b/service/startup/service.go
@@ -114,7 +114,7 @@ func (s *Service) Run(ctx context.Context) error {
}
time.Sleep(1 * time.Second)
- rqliteClient := httpclix.Default(httpcli.WithMiddlewares(middlewares.SqlOperationMiddleware(), httpclix.Log(s.logger)))
+ rqliteClient := httpclix.Default(httpcli.WithMiddlewares(middlewares.SqlOperationMiddleware()))
rqliteClient.GlobalRequestConfig().BaseUrl = s.rqlite.LocalHttpAddr()
rqliteClient.GlobalRequestConfig().BasicAuth = s.rqlite.InternalClientCredential()
db, err := db.Open(
diff --git a/service/subscription/service.go b/service/subscription/service.go
index 23287fa..d6572ee 100644
--- a/service/subscription/service.go
+++ b/service/subscription/service.go
@@ -27,17 +27,22 @@ type ConfigRepo interface {
GetActive(ctx context.Context, moduleId string) (*entity.Config, error)
}
+type VariableService interface {
+ RenderConfig(ctx context.Context, input []byte) ([]byte, error)
+}
+
type Emitter interface {
Emit(ctx context.Context, conn *etp.Conn, event string, data []byte)
}
type Service struct {
- moduleRepo ModuleRepo
- backendRepo BackendRepo
- configRepo ConfigRepo
- rooms *etp.Rooms
- emitter Emitter
- logger log.Logger
+ moduleRepo ModuleRepo
+ backendRepo BackendRepo
+ configRepo ConfigRepo
+ rooms *etp.Rooms
+ emitter Emitter
+ variableService VariableService
+ logger log.Logger
}
func NewService(
@@ -46,15 +51,17 @@ func NewService(
configRepo ConfigRepo,
rooms *etp.Rooms,
emitter Emitter,
+ variableService VariableService,
logger log.Logger,
) Service {
return Service{
- moduleRepo: moduleRepo,
- backendRepo: backendRepo,
- configRepo: configRepo,
- rooms: rooms,
- emitter: emitter,
- logger: logger,
+ moduleRepo: moduleRepo,
+ backendRepo: backendRepo,
+ configRepo: configRepo,
+ rooms: rooms,
+ emitter: emitter,
+ variableService: variableService,
+ logger: logger,
}
}
@@ -73,10 +80,14 @@ func (s Service) NotifyConfigChanged(ctx context.Context, moduleId string) error
if err != nil {
return errors.WithMessage(err, "get active config")
}
+ configData, err := s.variableService.RenderConfig(ctx, config.Data)
+ if err != nil {
+ return errors.WithMessage(err, "render config")
+ }
for _, conn := range conns {
go func() {
- s.emitter.Emit(ctx, conn, cluster.ConfigSendConfigChanged, config.Data)
+ s.emitter.Emit(ctx, conn, cluster.ConfigSendConfigChanged, configData)
}()
}
diff --git a/service/variable/service.go b/service/variable/service.go
new file mode 100644
index 0000000..30756b0
--- /dev/null
+++ b/service/variable/service.go
@@ -0,0 +1,325 @@
+package variable
+
+import (
+ "context"
+ "github.com/pkg/errors"
+ "isp-config-service/domain"
+ "isp-config-service/entity"
+ "isp-config-service/entity/xtypes"
+ "regexp"
+ "strings"
+ "time"
+)
+
+type Repo interface {
+ All(ctx context.Context) ([]entity.Variable, error)
+ GetByName(ctx context.Context, name string) (*entity.Variable, error)
+ Insert(ctx context.Context, variable entity.Variable) error
+ Update(ctx context.Context, variable entity.Variable) (bool, error)
+ Upsert(ctx context.Context, variables []entity.Variable) error
+ Delete(ctx context.Context, name string) (bool, error)
+ UpsertLinks(ctx context.Context, configId string, links []entity.ConfigHasVariable) error
+}
+
+type ConfigRepo interface {
+ GetMetaByVariables(ctx context.Context, variables []string) (map[string][]entity.ConfigMetaWithVariable, error)
+}
+
+type EventRepo interface {
+ Insert(ctx context.Context, event entity.Event) error
+}
+
+type Service struct {
+ repo Repo
+ configRepo ConfigRepo
+ eventRepo EventRepo
+ stringToIntRegexp *regexp.Regexp
+ variableRegexp *regexp.Regexp
+}
+
+func NewService(
+ repo Repo,
+ configRepo ConfigRepo,
+ eventRepo EventRepo,
+) Service {
+ return Service{
+ repo: repo,
+ configRepo: configRepo,
+ eventRepo: eventRepo,
+ stringToIntRegexp: regexp.MustCompile(`"_ToInt\((\d+)\)"`),
+ variableRegexp: regexp.MustCompile(`_Var\((.*?)\)`),
+ }
+}
+
+func (s Service) All(ctx context.Context) ([]domain.Variable, error) {
+ variables, err := s.repo.All(ctx)
+ if err != nil {
+ return nil, errors.WithMessage(err, "get all variables")
+ }
+ if len(variables) == 0 {
+ return []domain.Variable{}, nil
+ }
+
+ varNames := make([]string, 0, len(variables))
+ for _, v := range variables {
+ varNames = append(varNames, v.Name)
+ }
+ metaByVariables, err := s.configRepo.GetMetaByVariables(ctx, varNames)
+ if err != nil {
+ return nil, errors.WithMessage(err, "get meta by variables")
+ }
+
+ result := make([]domain.Variable, 0, len(variables))
+ for _, v := range variables {
+ result = append(result, s.toDto(v, metaByVariables))
+ }
+
+ return result, nil
+}
+
+func (s Service) GetByName(ctx context.Context, name string) (*domain.Variable, error) {
+ variable, err := s.repo.GetByName(ctx, name)
+ if err != nil {
+ return nil, errors.WithMessage(err, "get variable by name")
+ }
+ if variable == nil {
+ return nil, entity.ErrVariableNotFound
+ }
+
+ metaByVariables, err := s.configRepo.GetMetaByVariables(ctx, []string{name})
+ if err != nil {
+ return nil, errors.WithMessage(err, "get meta by variables")
+ }
+
+ result := s.toDto(*variable, metaByVariables)
+ return &result, nil
+}
+
+func (s Service) Create(ctx context.Context, req domain.CreateVariableRequest) error {
+ variable := entity.Variable{
+ Name: req.Name,
+ Description: req.Description,
+ Type: req.Type,
+ Value: req.Value,
+ }
+ err := s.repo.Insert(ctx, variable)
+ if err != nil {
+ return errors.WithMessage(err, "insert variable")
+ }
+ return nil
+}
+
+func (s Service) Update(ctx context.Context, req domain.UpdateVariableRequest) error {
+ variable := entity.Variable{
+ Name: req.Name,
+ Description: req.Description,
+ Value: req.Value,
+ }
+ updated, err := s.repo.Update(ctx, variable)
+ if err != nil {
+ return errors.WithMessage(err, "update variable")
+ }
+ if !updated {
+ return entity.ErrVariableNotFound
+ }
+
+ err = s.syncConfigsByVariables(ctx, []string{variable.Name})
+ if err != nil {
+ return errors.WithMessage(err, "sync configs by variables")
+ }
+ return nil
+}
+
+func (s Service) Upsert(ctx context.Context, req []domain.UpsertVariableRequest) error {
+ if len(req) == 0 {
+ return nil
+ }
+
+ variables := make([]entity.Variable, 0, len(req))
+ variableNames := make([]string, 0, len(req))
+ for _, request := range req {
+ variables = append(variables, entity.Variable{
+ Name: request.Name,
+ Description: request.Description,
+ Type: request.Type,
+ Value: request.Value,
+ })
+ variableNames = append(variableNames, request.Name)
+ }
+ err := s.repo.Upsert(ctx, variables)
+ if err != nil {
+ return errors.WithMessage(err, "upsert variables")
+ }
+
+ err = s.syncConfigsByVariables(ctx, variableNames)
+ if err != nil {
+ return errors.WithMessage(err, "sync configs by variables")
+ }
+
+ return nil
+}
+
+func (s Service) Delete(ctx context.Context, name string) error {
+ metaByVariables, err := s.configRepo.GetMetaByVariables(ctx, []string{name})
+ if err != nil {
+ return errors.WithMessage(err, "get meta by variables")
+ }
+ if len(metaByVariables[name]) > 0 {
+ return entity.ErrVariableUsedInConfigs
+ }
+
+ deleted, err := s.repo.Delete(ctx, name)
+ if err != nil {
+ return errors.WithMessage(err, "delete variable")
+ }
+ if !deleted {
+ return entity.ErrVariableNotFound
+ }
+
+ return nil
+}
+
+//nolint:funlen
+func (s Service) RenderConfig(ctx context.Context, input []byte) ([]byte, error) {
+ variables, err := s.repo.All(ctx)
+ if err != nil {
+ return nil, errors.WithMessage(err, "get all variables")
+ }
+ if len(variables) == 0 {
+ return input, nil
+ }
+ varsMap := make(map[string]string, len(variables))
+ for _, variable := range variables {
+ varsMap[variable.Name] = variable.Value
+ }
+
+ undefinedVariables := make([]string, 0)
+ withReplacedVars := s.variableRegexp.ReplaceAllStringFunc(string(input), func(group string) string {
+ varName := s.variableRegexp.FindStringSubmatch(group)[1]
+
+ value, ok := varsMap[varName]
+ if !ok {
+ undefinedVariables = append(undefinedVariables, varName)
+ return varName
+ }
+ return value
+ })
+ if len(undefinedVariables) > 0 {
+ return nil, errors.Errorf("undefined variables: [%s]", strings.Join(undefinedVariables, ", "))
+ }
+
+ result := s.stringToIntRegexp.ReplaceAll([]byte(withReplacedVars), []byte("$1"))
+
+ return result, nil
+}
+
+func (s Service) ExtractVariables(ctx context.Context, configId string, input []byte) (*domain.VariableExtractionResult, error) {
+ matches := s.variableRegexp.FindAllStringSubmatch(string(input), -1)
+ varNames := make([]string, len(matches))
+ for i, match := range matches {
+ varNames[i] = match[1]
+ }
+ if len(varNames) == 0 {
+ return &domain.VariableExtractionResult{
+ VariableLinks: []entity.ConfigHasVariable{},
+ AbsentVariables: []string{},
+ }, nil
+ }
+
+ allVariables, err := s.repo.All(ctx)
+ if err != nil {
+ return nil, errors.WithMessage(err, "get all variables")
+ }
+ allVariablesMap := make(map[string]bool, len(allVariables))
+ for _, variable := range allVariables {
+ allVariablesMap[variable.Name] = true
+ }
+
+ absentVariables := make([]string, 0)
+ variableLinks := make([]entity.ConfigHasVariable, 0)
+ for _, name := range varNames {
+ if !allVariablesMap[name] {
+ absentVariables = append(absentVariables, name)
+ continue
+ }
+ variableLinks = append(variableLinks, entity.ConfigHasVariable{
+ ConfigId: configId,
+ VariableName: name,
+ })
+ }
+
+ return &domain.VariableExtractionResult{
+ VariableLinks: variableLinks,
+ AbsentVariables: absentVariables,
+ }, nil
+}
+
+func (s Service) SaveVariableLinks(ctx context.Context, configId string, links []entity.ConfigHasVariable) error {
+ if len(links) == 0 {
+ return nil
+ }
+
+ err := s.repo.UpsertLinks(ctx, configId, links)
+ if err != nil {
+ return errors.WithMessage(err, "upsert links")
+ }
+
+ return nil
+}
+
+func (s Service) toDto(variable entity.Variable, metaByVariables map[string][]entity.ConfigMetaWithVariable) domain.Variable {
+ value := variable.Value
+ if variable.Type == "SECRET" {
+ value = ""
+ }
+ containsInConfigs := []domain.LinkedConfig{}
+ for _, metaWithVariable := range metaByVariables[variable.Name] {
+ containsInConfigs = append(containsInConfigs, domain.LinkedConfig{
+ Id: metaWithVariable.Id,
+ ModuleId: metaWithVariable.ModuleId,
+ Name: metaWithVariable.Name,
+ })
+ }
+ return domain.Variable{
+ Name: variable.Name,
+ Description: variable.Description,
+ Type: variable.Type,
+ Value: value,
+ CreatedAt: time.Time(variable.CreatedAt),
+ UpdatedAt: time.Time(variable.UpdatedAt),
+ ContainsInConfigs: containsInConfigs,
+ }
+}
+
+func (s Service) syncConfigsByVariables(ctx context.Context, variables []string) error {
+ metaByVariables, err := s.configRepo.GetMetaByVariables(ctx, variables)
+ if err != nil {
+ return errors.WithMessage(err, "get meta by variables")
+ }
+ modulesToSync := make(map[string]bool)
+ for _, variable := range variables {
+ for _, withVariable := range metaByVariables[variable] {
+ if !withVariable.Active {
+ continue
+ }
+ modulesToSync[withVariable.ModuleId] = true
+ }
+ }
+
+ for moduleId := range modulesToSync {
+ err := s.eventRepo.Insert(ctx, entity.Event{
+ Payload: xtypes.Json[entity.EventPayload]{
+ Value: entity.EventPayload{
+ ConfigUpdated: &entity.PayloadConfigUpdated{
+ ModuleId: moduleId,
+ },
+ },
+ },
+ })
+ if err != nil {
+ return errors.WithMessagef(err, "insert change config event for moduleId: %s", moduleId)
+ }
+ }
+
+ return nil
+}
diff --git a/tests/acceptance_test.go b/tests/acceptance_test.go
index 0e6fd37..bd3945a 100644
--- a/tests/acceptance_test.go
+++ b/tests/acceptance_test.go
@@ -23,36 +23,17 @@ import (
//nolint:funlen
func TestAcceptance(t *testing.T) {
require := require.New(t)
+ logger := setupTest(t)
- t.Setenv("APP_CONFIG_PATH", "../conf/config.yml")
- t.Setenv("DefaultRemoteConfigPath", "../conf/default_remote_config.json")
- boot := bootstrap.New("1.0.0", conf.Remote{}, nil)
- boot.MigrationsDir = "../migrations"
- dataPath := dataDir(t)
- boot.App.Config().Set("rqlite.DataPath", dataPath)
- logger := boot.App.Logger()
-
- startup, err := startup.New(boot)
- require.NoError(err)
- t.Cleanup(func() {
- for _, closer := range startup.Closers() {
- err := closer.Close()
- require.NoError(err)
- }
- })
- err = startup.Run(context.Background())
- require.NoError(err)
- time.Sleep(1 * time.Second)
-
- clientA1 := newClusterClient("A", "10.2.9.1", logger)
+ clientA1 := newClusterClient(t, "A", "10.2.9.1", logger)
go func() {
handler := cluster.NewEventHandler()
- err := clientA1.Run(context.Background(), handler)
+ err := clientA1.Run(t.Context(), handler)
require.NoError(err) //nolint:testifylint
}()
- clientA2 := newClusterClient("A", "10.2.9.2", logger)
- clientA2Ctx, cancelClient2 := context.WithCancel(context.Background())
+ clientA2 := newClusterClient(t, "A", "10.2.9.2", logger)
+ clientA2Ctx, cancelClient2 := context.WithCancel(t.Context())
go func() {
handler := cluster.NewEventHandler()
err := clientA2.Run(clientA2Ctx, handler)
@@ -60,14 +41,14 @@ func TestAcceptance(t *testing.T) {
}()
time.Sleep(2 * time.Second)
- clientB := newClusterClient("B", "10.2.9.2", logger)
+ clientB := newClusterClient(t, "B", "10.2.9.2", logger)
eventHandler := newClusterEventHandler()
go func() {
handler := cluster.NewEventHandler().
RemoteConfigReceiver(eventHandler).
RequireModule("A", eventHandler).
RoutesReceiver(eventHandler)
- err := clientB.Run(context.Background(), handler)
+ err := clientB.Run(t.Context(), handler)
require.NoError(err) //nolint:testifylint
}()
time.Sleep(2 * time.Second)
@@ -80,7 +61,7 @@ func TestAcceptance(t *testing.T) {
err = apiCli.Invoke("config/config/get_active_config_by_module_name").
JsonRequestBody(domain.GetByModuleNameRequest{ModuleName: "B"}).
JsonResponseBody(&activeConfig).
- Do(context.Background())
+ Do(t.Context())
require.NoError(err)
updateConfigReq := domain.CreateUpdateConfigRequest{
Id: activeConfig.Id,
@@ -91,7 +72,7 @@ func TestAcceptance(t *testing.T) {
}
err = apiCli.Invoke("config/config/create_update_config").
JsonRequestBody(updateConfigReq).
- Do(context.Background())
+ Do(t.Context())
require.NoError(err)
cancelClient2()
@@ -111,7 +92,7 @@ func TestAcceptance(t *testing.T) {
statusResponse := make([]domain.ModuleInfo, 0)
err = apiCli.Invoke("config/module/get_modules_info").
JsonResponseBody(&statusResponse).
- Do(context.Background())
+ Do(t.Context())
require.NoError(err)
require.Len(statusResponse, 3)
require.EqualValues("A", statusResponse[0].Name)
@@ -138,16 +119,30 @@ type testModuleRemoteConfig struct {
}
func newClusterClient(
+ t *testing.T,
moduleName string,
host string,
logger log.Logger,
) *cluster.Client {
- schema := schema.NewGenerator().Generate(testModuleRemoteConfig{})
+ t.Helper()
+ return newClusterClientWith(t, moduleName, host, testModuleRemoteConfig{}, []byte("{}"), logger)
+}
+
+func newClusterClientWith(
+ t *testing.T,
+ moduleName string,
+ host string,
+ config any,
+ defaultRemoteConfig []byte,
+ logger log.Logger,
+) *cluster.Client {
+ t.Helper()
+ schema := schema.NewGenerator().Generate(config)
schemaData, err := json.Marshal(schema)
if err != nil {
panic(err)
}
- return cluster.NewClient(cluster.ModuleInfo{
+ cli := cluster.NewClient(cluster.ModuleInfo{
ModuleName: moduleName,
ModuleVersion: "1.0.0",
LibVersion: "1.0.0",
@@ -159,6 +154,38 @@ func newClusterClient(
}, cluster.ConfigData{
Version: "1.0.0",
Schema: schemaData,
- Config: []byte(`{}`),
+ Config: defaultRemoteConfig,
}, []string{"127.0.0.1:9001"}, logger)
+ t.Cleanup(func() {
+ _ = cli.Close()
+ })
+ return cli
+}
+
+//nolint:ireturn
+func setupTest(t *testing.T) log.Logger {
+ t.Helper()
+ require := require.New(t)
+
+ t.Setenv("APP_CONFIG_PATH", "../conf/config.yml")
+ t.Setenv("DefaultRemoteConfigPath", "../conf/default_remote_config.json")
+ boot := bootstrap.New("1.0.0", conf.Remote{}, nil)
+ boot.MigrationsDir = "../migrations"
+ dataPath := dataDir(t)
+ boot.App.Config().Set("rqlite.DataPath", dataPath)
+ logger := boot.App.Logger()
+
+ startup, err := startup.New(boot)
+ require.NoError(err)
+ t.Cleanup(func() {
+ for _, closer := range startup.Closers() {
+ err := closer.Close()
+ require.NoError(err)
+ }
+ })
+ err = startup.Run(t.Context())
+ require.NoError(err)
+ time.Sleep(1 * time.Second)
+
+ return logger
}
diff --git a/tests/variable_test.go b/tests/variable_test.go
new file mode 100644
index 0000000..88d8baa
--- /dev/null
+++ b/tests/variable_test.go
@@ -0,0 +1,130 @@
+package tests_test
+
+import (
+ "github.com/stretchr/testify/require"
+ "github.com/txix-open/isp-kit/cluster"
+ "github.com/txix-open/isp-kit/grpc/client"
+ "github.com/txix-open/isp-kit/json"
+ "github.com/txix-open/isp-kit/test/fake"
+ "isp-config-service/domain"
+ "strconv"
+ "testing"
+ "time"
+)
+
+const defaultRemoteConfigsWithVariables = `
+{
+ "varA": "_Var(varA)",
+ "varB": "_ToInt(_Var(varB))",
+ "varC": "{{ msp_pgsql_name }}"
+}
+`
+
+type configWithVars struct {
+ VarA string
+ VarB int
+ VarC string
+}
+
+// nolint:funlen
+func TestVariableAcceptance(t *testing.T) {
+ require := require.New(t)
+ logger := setupTest(t)
+
+ apiCli, err := client.Default()
+ require.NoError(err)
+ apiCli.Upgrade([]string{"127.0.0.1:9002"})
+ varAValue := fake.It[string]()
+ varA := domain.CreateVariableRequest{
+ Name: "varA",
+ Description: fake.It[string](),
+ Type: "TEXT",
+ Value: varAValue,
+ }
+ err = apiCli.Invoke("config/variable/create").
+ JsonRequestBody(varA).
+ Do(t.Context())
+ require.NoError(err)
+ err = apiCli.Invoke("config/variable/create").
+ JsonRequestBody(varA).
+ Do(t.Context())
+ require.Error(err)
+
+ varBValue := fake.It[int]()
+ err = apiCli.Invoke("config/variable/upsert").
+ JsonRequestBody([]domain.UpsertVariableRequest{{
+ Name: "varB",
+ Description: "test",
+ Type: "SECRET",
+ Value: strconv.Itoa(varBValue),
+ }}).
+ Do(t.Context())
+ require.NoError(err)
+
+ eventHandler := newClusterEventHandler()
+ clientA1 := newClusterClientWith(
+ t,
+ "A",
+ "10.2.9.1",
+ configWithVars{},
+ []byte(defaultRemoteConfigsWithVariables),
+ logger,
+ )
+ go func() {
+ handler := cluster.NewEventHandler().RemoteConfigReceiverWithTimeout(eventHandler, 5*time.Second)
+ err := clientA1.Run(t.Context(), handler)
+ require.NoError(err) //nolint:testifylint
+ }()
+ time.Sleep(3 * time.Second)
+
+ firstConfig := unmarshalConfig(require, eventHandler.ReceivedConfigs()[0])
+ expected := configWithVars{
+ VarA: varAValue,
+ VarB: varBValue,
+ VarC: "{{ msp_pgsql_name }}",
+ }
+ require.EqualValues(expected, firstConfig)
+
+ err = apiCli.Invoke("config/variable/delete").
+ JsonRequestBody(domain.VariableByNameRequest{Name: "varB"}).
+ Do(t.Context())
+ require.Error(err)
+
+ varBValue = fake.It[int]()
+ err = apiCli.Invoke("config/variable/upsert").
+ JsonRequestBody([]domain.UpsertVariableRequest{{
+ Name: "varB",
+ Description: "test",
+ Type: "SECRET",
+ Value: strconv.Itoa(varBValue),
+ }}).
+ Do(t.Context())
+ require.NoError(err)
+ time.Sleep(3 * time.Second)
+
+ secondConfig := unmarshalConfig(require, eventHandler.ReceivedConfigs()[1])
+ expected = configWithVars{
+ VarA: varAValue,
+ VarB: varBValue,
+ VarC: "{{ msp_pgsql_name }}",
+ }
+ require.EqualValues(expected, secondConfig)
+
+ allResponse := []domain.Variable{}
+ err = apiCli.Invoke("config/variable/all").
+ JsonResponseBody(&allResponse).
+ Do(t.Context())
+ require.NoError(err)
+
+ require.Len(allResponse, 2)
+ require.EqualValues(varAValue, allResponse[0].Value)
+ require.EqualValues("TEXT", allResponse[0].Type)
+ require.Empty(allResponse[1].Value) // secret
+}
+
+func unmarshalConfig(require *require.Assertions, configData []byte) configWithVars {
+ firstConfig := configWithVars{}
+ err := json.Unmarshal(configData, &firstConfig)
+ require.NoError(err)
+ return firstConfig
+}