[installer] Fix #8 - limit prefix length to 5 chars
This commit is contained in:
parent
5effd8bcdd
commit
c87d08dab9
|
@ -14,7 +14,7 @@ For other platforms, or if you don't have Homebrew installed, please see the fol
|
||||||
|
|
||||||
You will also need the following information for the installer:
|
You will also need the following information for the installer:
|
||||||
|
|
||||||
- A unique prefix to use for provisioned resources
|
- A unique prefix to use for provisioned resources (5 alphanumeric chars or less)
|
||||||
- A password to use for the RDS database
|
- A password to use for the RDS database
|
||||||
- The name of a IAM key pair to use for EC2 instances, if you provide a name which
|
- The name of a IAM key pair to use for EC2 instances, if you provide a name which
|
||||||
already exists it will be used, otherwise it will be generated for you.
|
already exists it will be used, otherwise it will be generated for you.
|
||||||
|
|
|
@ -233,7 +233,7 @@ function destroy() {
|
||||||
function provision() {
|
function provision() {
|
||||||
# If INFRA_PREFIX has not been set yet, request it from user
|
# If INFRA_PREFIX has not been set yet, request it from user
|
||||||
if [ -z "$INFRA_PREFIX" ]; then
|
if [ -z "$INFRA_PREFIX" ]; then
|
||||||
DEFAULT_INFRA_PREFIX=$(tr -dc 'a-z0-9' < /dev/urandom | fold -w 8 | head -n 1)
|
DEFAULT_INFRA_PREFIX=$(tr -dc 'a-z0-9' < /dev/urandom | fold -w 5 | head -n 1)
|
||||||
|
|
||||||
warnb << EOF
|
warnb << EOF
|
||||||
# Infrastructure Prefix
|
# Infrastructure Prefix
|
||||||
|
@ -254,12 +254,12 @@ EOF
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! echo "$INFRA_PREFIX" | grep -E '^[a-z0-9]{3,24}$'; then
|
if ! echo "$INFRA_PREFIX" | grep -E '^[a-z0-9]{3,5}$'; then
|
||||||
errorb << EOF
|
errorb << EOF
|
||||||
The prefix '$INFRA_PREFIX' is invalid!
|
The prefix '$INFRA_PREFIX' is invalid!
|
||||||
|
|
||||||
It must consist only of the lowercase characters a-z and digits 0-9,
|
It must consist only of the lowercase characters a-z and digits 0-9,
|
||||||
and must be between 3 and 24 characters long.
|
and must be between 3 and 5 characters long.
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue