Skip to content

Commit 2aaff87

Browse files
committed
Update name validation.
1 parent 21eb9c6 commit 2aaff87

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/prompt.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828

2929
var (
3030
validEnvName = regexp.MustCompile(`^[A-Z0-9-_]+$`)
31-
validName = regexp.MustCompile(`^[a-z][a-z0-9-_]*$`)
31+
validName = regexp.MustCompile(`^[a-z0-9]([a-z0-9-]*[a-z0-9])?$`)
3232
validPath = regexp.MustCompile(`^(/[a-zA-Z0-9-_]+)+$`)
3333
)
3434

@@ -472,7 +472,7 @@ func validateEnvName(val interface{}) error {
472472

473473
func validateName(val interface{}) error {
474474
if !validName.MatchString(val.(string)) {
475-
return errors.New("Name must start with a-z followed by a-z, 0-9, dash (-) or underscore (_)")
475+
return errors.New("Name must only contain a-z, 0-9 or dash (-), and must start and end with a-z or 0-9")
476476
}
477477
return nil
478478
}

0 commit comments

Comments
 (0)