diff --git a/custom/conf/app.ini.sample b/custom/conf/app.ini.sample index d47b71859..7cff3aa3b 100644 --- a/custom/conf/app.ini.sample +++ b/custom/conf/app.ini.sample @@ -580,7 +580,7 @@ MIN_INTERVAL = 10m [api] ; Enables Swagger. True or false; default is true. -ENABLE_SWAGGER_ENDPOINT = true +ENABLE_SWAGGER = true ; Max number of items in a page MAX_RESPONSE_ITEMS = 50 diff --git a/modules/context/context.go b/modules/context/context.go index 7f9193f82..a83187365 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -264,7 +264,7 @@ func Contexter() macaron.Handler { ctx.Data["ShowRegistrationButton"] = setting.Service.ShowRegistrationButton ctx.Data["ShowFooterBranding"] = setting.ShowFooterBranding ctx.Data["ShowFooterVersion"] = setting.ShowFooterVersion - ctx.Data["EnableSwaggerEndpoint"] = setting.API.EnableSwaggerEndpoint + ctx.Data["EnableSwagger"] = setting.API.EnableSwagger ctx.Data["EnableOpenIDSignIn"] = setting.Service.EnableOpenIDSignIn c.Map(ctx) diff --git a/modules/setting/setting.go b/modules/setting/setting.go index b44ba4d11..3755f2ded 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -525,11 +525,11 @@ var ( // API settings API = struct { - EnableSwaggerEndpoint bool - MaxResponseItems int + EnableSwagger bool + MaxResponseItems int }{ - EnableSwaggerEndpoint: true, - MaxResponseItems: 50, + EnableSwagger: true, + MaxResponseItems: 50, } U2F = struct { diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 3174e5637..5d47570c5 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -278,13 +278,13 @@ func mustAllowPulls(ctx *context.Context) { func RegisterRoutes(m *macaron.Macaron) { bind := binding.Bind - if setting.API.EnableSwaggerEndpoint { + if setting.API.EnableSwagger { m.Get("/swagger", misc.Swagger) //Render V1 by default } m.Group("/v1", func() { // Miscellaneous - if setting.API.EnableSwaggerEndpoint { + if setting.API.EnableSwagger { m.Get("/swagger", misc.Swagger) } m.Get("/version", misc.Version) diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 233704452..8c196d8bb 100644 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -755,7 +755,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Post("/purge", user.NotificationPurgePost) }, reqSignIn) - if setting.API.EnableSwaggerEndpoint { + if setting.API.EnableSwagger { m.Get("/swagger.v1.json", templates.JSONRenderer(), routers.SwaggerV1Json) } diff --git a/templates/base/footer.tmpl b/templates/base/footer.tmpl index a23ae5730..26ba3421f 100644 --- a/templates/base/footer.tmpl +++ b/templates/base/footer.tmpl @@ -29,7 +29,7 @@ JavaScript licenses - {{if .EnableSwaggerEndpoint}}API{{end}} + {{if .EnableSwagger}}API{{end}} {{.i18n.Tr "website"}} {{if (or .ShowFooterVersion .PageIsAdmin)}}{{GoVer}}{{end}}