Rename ENABLE_SWAGGER_ENDPOINT option to ENABLE_SWAGGER

This commit is contained in:
Piotr Orzechowski 2018-02-24 16:19:16 +01:00
parent 0661ed94d5
commit a7afc4902b
6 changed files with 10 additions and 10 deletions

View File

@ -580,7 +580,7 @@ MIN_INTERVAL = 10m
[api] [api]
; Enables Swagger. True or false; default is true. ; Enables Swagger. True or false; default is true.
ENABLE_SWAGGER_ENDPOINT = true ENABLE_SWAGGER = true
; Max number of items in a page ; Max number of items in a page
MAX_RESPONSE_ITEMS = 50 MAX_RESPONSE_ITEMS = 50

View File

@ -264,7 +264,7 @@ func Contexter() macaron.Handler {
ctx.Data["ShowRegistrationButton"] = setting.Service.ShowRegistrationButton ctx.Data["ShowRegistrationButton"] = setting.Service.ShowRegistrationButton
ctx.Data["ShowFooterBranding"] = setting.ShowFooterBranding ctx.Data["ShowFooterBranding"] = setting.ShowFooterBranding
ctx.Data["ShowFooterVersion"] = setting.ShowFooterVersion ctx.Data["ShowFooterVersion"] = setting.ShowFooterVersion
ctx.Data["EnableSwaggerEndpoint"] = setting.API.EnableSwaggerEndpoint ctx.Data["EnableSwagger"] = setting.API.EnableSwagger
ctx.Data["EnableOpenIDSignIn"] = setting.Service.EnableOpenIDSignIn ctx.Data["EnableOpenIDSignIn"] = setting.Service.EnableOpenIDSignIn
c.Map(ctx) c.Map(ctx)

View File

@ -525,11 +525,11 @@ var (
// API settings // API settings
API = struct { API = struct {
EnableSwaggerEndpoint bool EnableSwagger bool
MaxResponseItems int MaxResponseItems int
}{ }{
EnableSwaggerEndpoint: true, EnableSwagger: true,
MaxResponseItems: 50, MaxResponseItems: 50,
} }
U2F = struct { U2F = struct {

View File

@ -278,13 +278,13 @@ func mustAllowPulls(ctx *context.Context) {
func RegisterRoutes(m *macaron.Macaron) { func RegisterRoutes(m *macaron.Macaron) {
bind := binding.Bind bind := binding.Bind
if setting.API.EnableSwaggerEndpoint { if setting.API.EnableSwagger {
m.Get("/swagger", misc.Swagger) //Render V1 by default m.Get("/swagger", misc.Swagger) //Render V1 by default
} }
m.Group("/v1", func() { m.Group("/v1", func() {
// Miscellaneous // Miscellaneous
if setting.API.EnableSwaggerEndpoint { if setting.API.EnableSwagger {
m.Get("/swagger", misc.Swagger) m.Get("/swagger", misc.Swagger)
} }
m.Get("/version", misc.Version) m.Get("/version", misc.Version)

View File

@ -755,7 +755,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Post("/purge", user.NotificationPurgePost) m.Post("/purge", user.NotificationPurgePost)
}, reqSignIn) }, reqSignIn)
if setting.API.EnableSwaggerEndpoint { if setting.API.EnableSwagger {
m.Get("/swagger.v1.json", templates.JSONRenderer(), routers.SwaggerV1Json) m.Get("/swagger.v1.json", templates.JSONRenderer(), routers.SwaggerV1Json)
} }

View File

@ -29,7 +29,7 @@
</div> </div>
</div> </div>
<a href="{{AppSubUrl}}/vendor/librejs.html" data-jslicense="1">JavaScript licenses</a> <a href="{{AppSubUrl}}/vendor/librejs.html" data-jslicense="1">JavaScript licenses</a>
{{if .EnableSwaggerEndpoint}}<a href="{{AppSubUrl}}/api/swagger">API</a>{{end}} {{if .EnableSwagger}}<a href="{{AppSubUrl}}/api/swagger">API</a>{{end}}
<a target="_blank" rel="noopener noreferrer" href="https://gitea.io">{{.i18n.Tr "website"}}</a> <a target="_blank" rel="noopener noreferrer" href="https://gitea.io">{{.i18n.Tr "website"}}</a>
{{if (or .ShowFooterVersion .PageIsAdmin)}}<span class="version">{{GoVer}}</span>{{end}} {{if (or .ShowFooterVersion .PageIsAdmin)}}<span class="version">{{GoVer}}</span>{{end}}
</div> </div>