Precompile regex
This commit is contained in:
parent
b1d6d28a90
commit
f361e1d894
|
@ -86,10 +86,10 @@ func (c *RunConfig) Prepare(ctx *interpolate.Context) []error {
|
|||
}
|
||||
}
|
||||
|
||||
m, _ := regexp.MatchString("(stop|terminate)", c.InstanceInitiatedShutdownBehavior)
|
||||
var reShutdownBehavior = regexp.MustCompile("(stop|terminate)")
|
||||
if c.InstanceInitiatedShutdownBehavior == "" {
|
||||
c.InstanceInitiatedShutdownBehavior = "stop"
|
||||
} else if !m {
|
||||
} else if !reShutdownBehavior.MatchString(c.InstanceInitiatedShutdownBehavior) {
|
||||
errs = append(errs, fmt.Errorf("shutdown_behaviour only accepts 'stop' or 'terminate' values."))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue