ArchiveLiteralSizeLimit: Use Constant Instead Hard Code (#731)

This use constant to instead hard code for ArchiveLiteralSizeLimit. That ensure if the limitation
value is changed in cli, the controller server can follow it. Otherwise, the condition will return
error, and make error HTTP response.

Later, we should delete it in fission-cli, and make it configurable it chart, to work in fission-
servers only.
This commit is contained in:
xiekeyang
2018-06-07 15:45:32 +08:00
committed by Ta-Ching Chen
parent 46d9808173
commit 8c96d9c6a0
+2 -2
View File
@@ -63,12 +63,12 @@ func (a *API) PackageApiCreate(w http.ResponseWriter, r *http.Request) {
}
// Ensure size limits
if len(f.Spec.Source.Literal) > 256*1024 {
if len(f.Spec.Source.Literal) > int(fission.ArchiveLiteralSizeLimit) {
err := fission.MakeError(fission.ErrorInvalidArgument, "Package literal larger than 256K")
a.respondWithError(w, err)
return
}
if len(f.Spec.Deployment.Literal) > 256*1024 {
if len(f.Spec.Deployment.Literal) > int(fission.ArchiveLiteralSizeLimit) {
err := fission.MakeError(fission.ErrorInvalidArgument, "Package literal larger than 256K")
a.respondWithError(w, err)
return