Skip to content

Commit

Permalink
tenant in swagger url (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-cronus authored Aug 29, 2024
1 parent a779136 commit f73ec73
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 74 deletions.
1 change: 1 addition & 0 deletions application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ cmd/eskimo-hut:
host: localhost:1443
version: local
defaultEndpointTimeout: 120s
tenant: sunwaves
httpServer:
port: 1443
certPath: cmd/eskimo-hut/.testdata/localhost.crt
Expand Down
2 changes: 1 addition & 1 deletion cmd/eskimo-hut/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ func parseProcessFaceRecognitionResultRequest(req *server.Request[ProcessFaceRec
usr.KYCStepsLastUpdatedAt = &nilDates
usr.KYCStepsCreatedAt = &nilDates
}
kycStepPassed := users.KYCStep(len(lastUpdatedAtDates))
kycStepPassed := users.KYCStep(len(lastUpdatedAtDates)) //nolint:gosec // .
usr.KYCStepPassed = &kycStepPassed
switch {
case *req.Data.Disabled:
Expand Down
3 changes: 2 additions & 1 deletion cmd/eskimo-hut/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ type (

const (
applicationYamlKey = "cmd/eskimo-hut"
swaggerRoot = "/users/w"
swaggerRootSuffix = "/users/w"
)

// Values for server.ErrorResponse#Code.
Expand Down Expand Up @@ -251,5 +251,6 @@ type (
APIKey string `yaml:"api-key" mapstructure:"api-key"` //nolint:tagliatelle // Nope.
Host string `yaml:"host"`
Version string `yaml:"version"`
Tenant string `yaml:"tenant"`
}
)
4 changes: 4 additions & 0 deletions cmd/eskimo-hut/eskimo_hut.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ func main() {
if cfg.APIKey == "" {
log.Panic("'api-key' is missing")
}
swaggerRoot := swaggerRootSuffix
if cfg.Tenant != "" {
swaggerRoot = "/" + cfg.Tenant + swaggerRootSuffix
}
server.New(new(service), applicationYamlKey, swaggerRoot).ListenAndServe(ctx, cancel)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/eskimo-hut/eskimo_hut_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var (
func TestMain(m *testing.M) {
const order = usersfixture.TestConnectorsOrder + 1
read := serverfixture.NewTestConnector("cmd/eskimo", "eskimo-hut", "", "", order+1, usersfixture.RContainerMounts()...)
write := serverfixture.NewTestConnector("cmd/eskimo-hut", "eskimo-hut", swaggerRoot, expectedSwaggerJSON, order, usersfixture.WContainerMounts()...)
write := serverfixture.NewTestConnector("cmd/eskimo-hut", "eskimo-hut", swaggerRootSuffix, expectedSwaggerJSON, order, usersfixture.WContainerMounts()...)
bridge = fixture.NewBridge(read, write)

connectorsfixture.
Expand Down
40 changes: 20 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ require (
github.com/ip2location/ip2location-go/v9 v9.7.0
github.com/jackc/pgx/v5 v5.6.0
github.com/pkg/errors v0.9.1
github.com/prometheus/common v0.55.0
github.com/prometheus/prometheus v0.54.0
github.com/prometheus/common v0.57.0
github.com/prometheus/prometheus v0.54.1
github.com/redis/go-redis/v9 v9.6.1
github.com/stretchr/testify v1.9.0
github.com/swaggo/swag v1.16.3
Expand Down Expand Up @@ -45,7 +45,7 @@ require (
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/andybalholm/cascadia v1.3.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bytedance/sonic v1.12.1 // indirect
github.com/bytedance/sonic v1.12.2 // indirect
github.com/bytedance/sonic/loader v0.2.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
Expand Down Expand Up @@ -89,9 +89,9 @@ require (
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.5-0.20231225225746-43d5d4cd4e0e // indirect
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect
github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 // indirect
github.com/google/s2a-go v0.1.8 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.3 // indirect
github.com/googleapis/gax-go/v2 v2.13.0 // indirect
github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
Expand All @@ -117,14 +117,14 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/onsi/ginkgo/v2 v2.20.1 // indirect
github.com/onsi/ginkgo/v2 v2.20.2 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/opencontainers/runc v1.1.13 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.20.1 // indirect
github.com/prometheus/client_golang v1.20.2 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
Expand All @@ -135,7 +135,7 @@ require (
github.com/sagikazarmark/locafero v0.6.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sendgrid/rest v2.6.9+incompatible // indirect
github.com/sendgrid/sendgrid-go v3.15.0+incompatible // indirect
github.com/sendgrid/sendgrid-go v3.16.0+incompatible // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
Expand All @@ -153,29 +153,29 @@ require (
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect
go.opentelemetry.io/otel v1.28.0 // indirect
go.opentelemetry.io/otel/metric v1.28.0 // indirect
go.opentelemetry.io/otel/trace v1.28.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect
go.opentelemetry.io/otel v1.29.0 // indirect
go.opentelemetry.io/otel/metric v1.29.0 // indirect
go.opentelemetry.io/otel/trace v1.29.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/mock v0.4.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/arch v0.9.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/time v0.6.0 // indirect
golang.org/x/tools v0.24.0 // indirect
google.golang.org/api v0.194.0 // indirect
google.golang.org/api v0.195.0 // indirect
google.golang.org/appengine/v2 v2.0.6 // indirect
google.golang.org/genproto v0.0.0-20240822170219-fc7c04adadcd // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect
google.golang.org/grpc v1.65.0 // indirect
google.golang.org/genproto v0.0.0-20240827150818-7e3bb234dfed // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240827150818-7e3bb234dfed // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect
google.golang.org/grpc v1.66.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit f73ec73

Please sign in to comment.