mirror of
https://github.com/hay-kot/homebox.git
synced 2025-08-05 17:10:30 +00:00
fix swagger stuff
This commit is contained in:
parent
f3c3ae5bd9
commit
4ccd3d7ace
3 changed files with 9 additions and 18 deletions
|
@ -13,7 +13,6 @@ import (
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
"github.com/go-chi/chi/v5/middleware"
|
"github.com/go-chi/chi/v5/middleware"
|
||||||
|
|
||||||
"github.com/hay-kot/homebox/backend/app/api/static/docs"
|
|
||||||
"github.com/hay-kot/homebox/backend/internal/core/services"
|
"github.com/hay-kot/homebox/backend/internal/core/services"
|
||||||
"github.com/hay-kot/homebox/backend/internal/data/ent"
|
"github.com/hay-kot/homebox/backend/internal/data/ent"
|
||||||
"github.com/hay-kot/homebox/backend/internal/data/migrations"
|
"github.com/hay-kot/homebox/backend/internal/data/migrations"
|
||||||
|
@ -53,8 +52,6 @@ func main() {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
docs.SwaggerInfo.Host = cfg.Swagger.Host
|
|
||||||
|
|
||||||
if err := run(cfg); err != nil {
|
if err := run(cfg); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ func (a *app) mountRoutes(r *chi.Mux, chain *errchain.ErrChain, repos *repo.AllR
|
||||||
registerMimes()
|
registerMimes()
|
||||||
|
|
||||||
r.Get("/swagger/*", httpSwagger.Handler(
|
r.Get("/swagger/*", httpSwagger.Handler(
|
||||||
httpSwagger.URL(fmt.Sprintf("%s://%s/swagger/doc.json", a.conf.Swagger.Scheme, a.conf.Swagger.Host)),
|
httpSwagger.URL(fmt.Sprintf("/swagger/doc.json")),
|
||||||
))
|
))
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
|
@ -15,15 +15,14 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Mode string `yaml:"mode" conf:"default:development"` // development or production
|
Mode string `yaml:"mode" conf:"default:development"` // development or production
|
||||||
Web WebConfig `yaml:"web"`
|
Web WebConfig `yaml:"web"`
|
||||||
Storage Storage `yaml:"storage"`
|
Storage Storage `yaml:"storage"`
|
||||||
Log LoggerConf `yaml:"logger"`
|
Log LoggerConf `yaml:"logger"`
|
||||||
Mailer MailerConf `yaml:"mailer"`
|
Mailer MailerConf `yaml:"mailer"`
|
||||||
Swagger SwaggerConf `yaml:"swagger"`
|
Demo bool `yaml:"demo"`
|
||||||
Demo bool `yaml:"demo"`
|
Debug DebugConf `yaml:"debug"`
|
||||||
Debug DebugConf `yaml:"debug"`
|
Options Options `yaml:"options"`
|
||||||
Options Options `yaml:"options"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Options struct {
|
type Options struct {
|
||||||
|
@ -36,11 +35,6 @@ type DebugConf struct {
|
||||||
Port string `yaml:"port" conf:"default:4000"`
|
Port string `yaml:"port" conf:"default:4000"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SwaggerConf struct {
|
|
||||||
Host string `yaml:"host" conf:"default:localhost:7745"`
|
|
||||||
Scheme string `yaml:"scheme" conf:"default:http"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebConfig struct {
|
type WebConfig struct {
|
||||||
Port string `yaml:"port" conf:"default:7745"`
|
Port string `yaml:"port" conf:"default:7745"`
|
||||||
Host string `yaml:"host"`
|
Host string `yaml:"host"`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue