Skip to content

Commit

Permalink
tenant url in swagger url (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-cronus authored Aug 29, 2024
1 parent bf3c4e9 commit d041b53
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
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/santa-sleigh:
host: localhost:7443
version: local
defaultEndpointTimeout: 30s
tenant: sunwaves
httpServer:
port: 7443
certPath: cmd/santa-sleigh/.testdata/localhost.crt
Expand Down
3 changes: 2 additions & 1 deletion cmd/santa-sleigh/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type (

const (
applicationYamlKey = "cmd/santa-sleigh"
swaggerRoot = "/achievements/w"
swaggerRootSuffix = "/achievements/w"
)

// Values for server.ErrorResponse#Code.
Expand All @@ -43,5 +43,6 @@ type (
config struct {
Host string `yaml:"host"`
Version string `yaml:"version"`
Tenant string `yaml:"tenant"`
}
)
4 changes: 4 additions & 0 deletions cmd/santa-sleigh/santa_sleigh.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ func main() {
appcfg.MustLoadFromKey(applicationYamlKey, &cfg)
api.SwaggerInfo.Host = cfg.Host
api.SwaggerInfo.Version = cfg.Version
swaggerRoot := swaggerRootSuffix
if cfg.Tenant != "" {
swaggerRoot = "/" + cfg.Tenant + swaggerRootSuffix
}
server.New(new(service), applicationYamlKey, swaggerRoot).ListenAndServe(ctx, cancel)
}

Expand Down

0 comments on commit d041b53

Please sign in to comment.