github.com/sap/cf-mta-plugin@v2.6.3+incompatible/configuration/properties/upload_chunk_size_configurable_property.go (about) 1 package properties 2 3 import ( 4 "errors" 5 "strconv" 6 ) 7 8 const DefaultUploadChunkSizeInMB = uint64(45) 9 10 var UploadChunkSizeInMB = ConfigurableProperty{ 11 Name: "MULTIAPPS_UPLOAD_CHUNK_SIZE", 12 DeprecatedNames: []string{ 13 "CHUNK_SIZE_IN_MB", 14 }, 15 Parser: uploadChunkSizeParser{}, 16 ParsingSuccessMessage: "Attention: You've specified a custom chunk size (%d MB) via the environment variable \"%s\".\n", 17 ParsingFailureMessage: "Attention: You've specified an INVALID custom chunk size (%s) via the environment variable \"%s\". Using default: %d\n", 18 DefaultValue: DefaultUploadChunkSizeInMB, 19 } 20 21 type uploadChunkSizeParser struct{} 22 23 func (p uploadChunkSizeParser) Parse(value string) (interface{}, error) { 24 parsedValue, err := parseUint64(value) 25 if err != nil { 26 return nil, err 27 } 28 if parsedValue == 0 { 29 return nil, errors.New("chunk size cannot be 0") 30 } 31 return parsedValue, nil 32 } 33 34 func parseUint64(value string) (uint64, error) { 35 return strconv.ParseUint(value, 10, 64) 36 }