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]
; 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

View File

@ -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)

View File

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

View File

@ -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)

View File

@ -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)
}

View File

@ -29,7 +29,7 @@
</div>
</div>
<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>
{{if (or .ShowFooterVersion .PageIsAdmin)}}<span class="version">{{GoVer}}</span>{{end}}
</div>