(flags *Flags)
| 55 | } |
| 56 | |
| 57 | func (c *Command) validateFlags(flags *Flags) error { |
| 58 | if !utils.IsBlank(conv.S(flags.DockerImage)) && !core.DockerImageURIRE.MatchString(conv.S(flags.DockerImage)) { |
| 59 | return fmt.Errorf("Invalid Docker image [%s]", conv.S(flags.DockerImage)) |
| 60 | } |
| 61 | |
| 62 | if !utils.IsBlank(conv.S(flags.DockerfilePath)) { |
| 63 | if err := c.validatePath(conv.S(flags.DockerfilePath)); err != nil { |
| 64 | return fmt.Errorf("Invalid Dockerfile path [%s]", conv.S(flags.DockerfilePath)) |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | if conv.I64(flags.Units) >= 0 && uint16(conv.I64(flags.Units)) > core.MaxAppUnits { |
| 69 | return fmt.Errorf("Units [%d] cannot exceed %d", conv.I64(flags.Units), core.MaxAppUnits) |
| 70 | } |
| 71 | |
| 72 | if conv.F64(flags.CPU) > core.MaxAppCPU { |
| 73 | return fmt.Errorf("CPU [%.2f] cannot exceed %d", conv.F64(flags.CPU), core.MaxAppCPU) |
| 74 | } |
| 75 | |
| 76 | if !utils.IsBlank(conv.S(flags.Memory)) && !core.SizeExpressionRE.MatchString(conv.S(flags.Memory)) { |
| 77 | return fmt.Errorf("Invalid app memory [%s]", conv.S(flags.Memory)) |
| 78 | } |
| 79 | |
| 80 | return nil |
| 81 | } |
| 82 | |
| 83 | func (c *Command) validatePath(path string) error { |
| 84 | if utils.IsBlank(path) { |
no test coverage detected