Skip to content

Commit

Permalink
add dynamic title to swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
YaroShkvorets committed Feb 29, 2024
1 parent 860b2e6 commit 221d4a7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ application:
http_host: "0.0.0.0:8080" # The HTTP host this application is listening on, leave empty to not start an HTTP server
grpc_host: "0.0.0.0:9000" # The gRPC host this application is listening on, leave empty to not start a gRPC server
domain: "localhost:8080" # The domain used for the Swagger documentation
chain_name: "Ethereum" # The name of the chain for Swagger documentation
sink_address: "localhost:8000" # The gRPC host of the sink server
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ import (
type Config struct {
Application *base_config.ApplicationConfig `yaml:"application" json:"application" mapstructure:"application" validate:"required"`
SinkAddress string `yaml:"sink_address" json:"sink_address" mapstructure:"sink_address" validate:"required"`
ChainName string `yaml:"chain_name" json:"chain_name" mapstructure:"chain_name"`
}
1 change: 1 addition & 0 deletions docker-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ application:
http_host: "0.0.0.0:8080" # The HTTP host this application is listening on, leave empty to not start an HTTP server
# grpc_host: "localhost:9000" # The gRPC host this application is listening on, leave empty to not start a gRPC server
domain: "" # The domain used for the Swagger documentation
chain_name: "Ethereum" # The name of the chain for Swagger documentation
sink_address: "host.docker.internal:8000" # The gRPC host of the sink server
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"github.com/eosnationftw/eosn-base-api/log"
)

// @title Ethereum Consensus Layer Blobs REST API
// @title Ethereum Blobs REST API
// @version 1.0
// @description This is the API for Ethereum Blobs.
// @description Use this API to get EIP-4844 blobs as a drop-in replacement for Consensus Layer clients API.

// @host localhost:8080
// @schemes http https
Expand Down
2 changes: 2 additions & 0 deletions server/http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ type HttpServer struct {
func (s *HttpServer) Initialize() {

swagger.SwaggerInfo.Host = s.App.Config.Application.Domain
swagger.SwaggerInfo.Title = s.App.Config.ChainName + " Blobs REST API"
swagger.SwaggerInfo.Description = "Use this API to get " + s.App.Config.ChainName + " EIP-4844 blobs as a drop-in replacement for Consensus Layer clients API."

s.Router = gin.New()

Expand Down

0 comments on commit 221d4a7

Please sign in to comment.