Rename ENABLE_SWAGGER_ENDPOINT option to ENABLE_SWAGGER
This commit is contained in:
parent
0661ed94d5
commit
a7afc4902b
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user