Expose Attachemnt Settings by API (#12514)

close #12368
This commit is contained in:
6543 2020-09-05 09:43:06 +02:00 committed by GitHub
parent bab1204db4
commit dba5d82f86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 94 additions and 0 deletions

View file

@ -60,3 +60,21 @@ func GetGeneralRepoSettings(ctx *context.APIContext) {
HTTPGitDisabled: setting.Repository.DisableHTTPGit,
})
}
// GetGeneralAttachmentSettings returns instance's global settings for Attachment
func GetGeneralAttachmentSettings(ctx *context.APIContext) {
// swagger:operation GET /settings/Attachment settings getGeneralAttachmentSettings
// ---
// summary: Get instance's global settings for Attachment
// produces:
// - application/json
// responses:
// "200":
// "$ref": "#/responses/GeneralAttachmentSettings"
ctx.JSON(http.StatusOK, api.GeneralAttachmentSettings{
Enabled: setting.Attachment.Enabled,
AllowedTypes: setting.Attachment.AllowedTypes,
MaxFiles: setting.Attachment.MaxFiles,
MaxSize: setting.Attachment.MaxSize,
})
}