File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package main
33import (
44 "fmt"
55 "os"
6+ "strings"
67
78 "github.com/NdoleStudio/httpsms/docs"
89 "github.com/NdoleStudio/httpsms/pkg/di"
@@ -33,7 +34,12 @@ func main() {
3334 di .LoadEnv ()
3435 }
3536
36- docs .SwaggerInfo .Host = os .Getenv ("SWAGGER_HOST" )
37+ if host := strings .TrimSpace (os .Getenv ("SWAGGER_HOST" )); len (host ) > 0 {
38+ docs .SwaggerInfo .Host = host
39+ }
40+ if len (Version ) > 0 {
41+ docs .SwaggerInfo .Version = Version
42+ }
3743
3844 container := di .NewContainer ("http-sms" , Version )
3945 container .Logger ().Info (container .App ().Listen (fmt .Sprintf ("%s:%s" , os .Getenv ("APP_HOST" ), os .Getenv ("APP_PORT" ))).Error ())
Original file line number Diff line number Diff line change 99 "strconv"
1010 "time"
1111
12+ "github.com/NdoleStudio/httpsms/docs"
13+
1214 otelMetric "go.opentelemetry.io/otel/metric"
1315
1416 "github.com/dgraph-io/ristretto"
@@ -1344,7 +1346,16 @@ func (container *Container) RegisterEventRoutes() {
13441346// RegisterSwaggerRoutes registers routes for swagger
13451347func (container * Container ) RegisterSwaggerRoutes () {
13461348 container .logger .Debug (fmt .Sprintf ("registering %T routes" , swagger .HandlerDefault ))
1347- container .App ().Get ("/*" , swagger .HandlerDefault )
1349+ container .App ().Get ("/*" , swagger .New (swagger.Config {
1350+ Title : docs .SwaggerInfo .Title ,
1351+ CustomScript : `
1352+ document.addEventListener("DOMContentLoaded", function(event) {
1353+ var links = document.querySelectorAll("link[rel~='icon']");
1354+ links.forEach(function (link) {
1355+ link.href = 'https://httpsms.com/favicon.ico';
1356+ });
1357+ });` ,
1358+ }))
13481359}
13491360
13501361// HeartbeatRepository registers a new instance of repositories.HeartbeatRepository
You can’t perform that action at this time.
0 commit comments