Merge pull request #45 from rede5/feat/dokku-setup
feat: atualiza URL do Swagger para suportar ambientes de produção
This commit is contained in:
commit
3e3116d2fa
1 changed files with 7 additions and 2 deletions
|
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"photum-backend/docs"
|
||||
|
|
@ -110,11 +111,15 @@ func main() {
|
|||
}
|
||||
|
||||
// Swagger UI
|
||||
url := ginSwagger.URL("http://localhost:8080/swagger/doc.json") // The url pointing to API definition
|
||||
swaggerScheme := "http"
|
||||
if cfg.AppEnv == "production" {
|
||||
swaggerScheme = "https"
|
||||
}
|
||||
swaggerURL := fmt.Sprintf("%s://%s/swagger/doc.json", swaggerScheme, cfg.SwaggerHost)
|
||||
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler,
|
||||
ginSwagger.PersistAuthorization(true),
|
||||
ginSwagger.DeepLinking(true),
|
||||
url,
|
||||
ginSwagger.URL(swaggerURL),
|
||||
))
|
||||
|
||||
// Public Routes
|
||||
|
|
|
|||
Loading…
Reference in a new issue