feat: allow disabling swagger ui and disable it by default (#1026)

* feat: allow disabling swagger ui and disable by default

* chore: Add codecov configuration to disable GitHub PR annotations
This commit is contained in:
Felipe Martin 2024-12-11 19:31:16 +01:00 committed by GitHub
parent 4aa0f51f10
commit 87bc7a87a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 8 deletions

2
codecov.yml Normal file
View file

@ -0,0 +1,2 @@
github_checks:
annotations: false

View file

@ -49,13 +49,14 @@ func readDotEnv(logger *logrus.Logger) map[string]string {
}
type HttpConfig struct {
Enabled bool `env:"HTTP_ENABLED,default=True"`
Port int `env:"HTTP_PORT,default=8080"`
Address string `env:"HTTP_ADDRESS,default=:"`
RootPath string `env:"HTTP_ROOT_PATH,default=/"`
AccessLog bool `env:"HTTP_ACCESS_LOG,default=True"`
ServeWebUI bool `env:"HTTP_SERVE_WEB_UI,default=True"`
SecretKey []byte `env:"HTTP_SECRET_KEY"`
Enabled bool `env:"HTTP_ENABLED,default=True"`
Port int `env:"HTTP_PORT,default=8080"`
Address string `env:"HTTP_ADDRESS,default=:"`
RootPath string `env:"HTTP_ROOT_PATH,default=/"`
AccessLog bool `env:"HTTP_ACCESS_LOG,default=True"`
ServeWebUI bool `env:"HTTP_SERVE_WEB_UI,default=True"`
ServeSwagger bool `env:"HTTP_SERVE_SWAGGER,default=False"`
SecretKey []byte `env:"HTTP_SECRET_KEY"`
// Fiber Specific
BodyLimit int `env:"HTTP_BODY_LIMIT,default=1024"`
ReadTimeout time.Duration `env:"HTTP_READ_TIMEOUT,default=10s"`

View file

@ -61,7 +61,10 @@ func (s *HttpServer) Setup(cfg *config.Config, deps *dependencies.Dependencies)
s.handle("/system", routes.NewSystemRoutes(s.logger))
s.handle("/bookmark", routes.NewBookmarkRoutes(s.logger, deps))
s.handle("/api/v1", api_v1.NewAPIRoutes(s.logger, deps, legacyRoutes.HandleLogin))
s.handle("/swagger", routes.NewSwaggerAPIRoutes(s.logger))
if cfg.Http.ServeSwagger {
s.handle("/swagger", routes.NewSwaggerAPIRoutes(s.logger))
}
s.http.Handler = s.engine
s.http.Addr = fmt.Sprintf("%s%d", cfg.Http.Address, cfg.Http.Port)