Skip to content

Commit d0c20bc

Browse files
authored
Update config.go
1 parent c812722 commit d0c20bc

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

server/v2/api/swagger/config.go

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
11
package swagger
22

3-
import "github.com/cosmos/cosmos-sdk/server/v2/config"
3+
import (
4+
"cosmossdk.io/core/server"
5+
)
6+
7+
const ServerName = "swagger"
48

5-
// Config represents Swagger configuration options
69
type Config struct {
7-
// Enable enables the Swagger UI endpoint
8-
Enable bool `mapstructure:"enable"`
9-
// Path is the URL path where Swagger UI will be served
10-
Path string `mapstructure:"path"`
10+
Enable bool `toml:"enable" mapstructure:"enable"`
11+
Address string `toml:"address" mapstructure:"address"`
12+
Path string `toml:"path" mapstructure:"path"`
1113
}
1214

13-
// DefaultConfig returns default configuration for Swagger
14-
func DefaultConfig() Config {
15-
return Config{
16-
Enable: false,
17-
Path: "/swagger",
15+
func DefaultConfig() *Config {
16+
return &Config{
17+
Enable: true,
18+
Address: "localhost:8080",
19+
Path: "/swagger/",
1820
}
1921
}
2022

21-
// Validate validates the configuration
22-
func (c Config) Validate() error {
23-
if c.Path == "" {
24-
return fmt.Errorf("swagger path cannot be empty")
25-
}
26-
return nil
27-
}
23+
type CfgOption func(*Config)

0 commit comments

Comments
 (0)