Limit incoming request body size for all endpoints and add rate limiting wrappera round storage
This commit is contained in:
@@ -17,6 +17,7 @@ type Config struct {
|
||||
Auth bool
|
||||
AuthLifetime time.Duration
|
||||
MaxFileSize int64
|
||||
RPS int
|
||||
}
|
||||
|
||||
func New() Config {
|
||||
@@ -37,6 +38,7 @@ func New() Config {
|
||||
as.Append(args.BOOL, "auth", "check for authorized access", false)
|
||||
as.Append(args.DURATION, "authlifetime", "duration auth is valid for", time.Hour)
|
||||
as.Append(args.INT, "max-file-size", "max file size for uploads in bytes", 50*(1<<20))
|
||||
as.Append(args.INT, "rps", "rps per namespace", 5)
|
||||
|
||||
if err := as.Parse(); err != nil {
|
||||
os.Remove(f.Name())
|
||||
@@ -53,5 +55,6 @@ func New() Config {
|
||||
Auth: as.GetBool("auth"),
|
||||
AuthLifetime: as.GetDuration("authlifetime"),
|
||||
MaxFileSize: int64(as.GetInt("max-file-size")),
|
||||
RPS: as.GetInt("rps"),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user