コード例 #1
0
// FromCli constructs a middleware instance from the command line parameters.
func FromCli(c *cli.Context) (plugin.Middleware, error) {
	return FromOther(
		RateLimit{
			PeriodSeconds: int64(c.Int("period")),
			Requests:      int64(c.Int("requests")),
			Burst:         int64(c.Int("burst")),
			Variable:      c.String("var"),
			RateVar:       c.String("rateVar")})
}
コード例 #2
0
// Constructs the middleware from the command line
func FromCli(c *cli.Context) (plugin.Middleware, error) {
	return NewConnLimit(int64(c.Int("connections")), c.String("var"))
}
コード例 #3
0
// FromCli constructs the middleware from the command line arguments
func FromCli(c *cli.Context) (plugin.Middleware, error) {
	return NewSpec(c.String("condition"), c.String("fallback"), c.String("onTripped"), c.String("onStandby"), c.Duration("fallbackDuration"), c.Duration("recoveryDuration"), c.Duration("checkPeriod"))
}
コード例 #4
0
// FromCli creates a Trace plugin object from command line
func FromCli(c *cli.Context) (plugin.Middleware, error) {
	return New(c.String("addr"), c.StringSlice("reqHeader"), c.StringSlice("respHeader"))
}
コード例 #5
0
func FromCli(c *cli.Context) (plugin.Middleware, error) {
	return NewRewrite(c.String("regexp"), c.String("replacement"), c.Bool("rewriteBody"), c.Bool("redirect"))
}