Skip to content

Commit dbe300b

Browse files
dtokidavidcheung
andauthored
User input validation (#22)
* add field validation * env shorten Co-authored-by: David Cheung <davidcheung@live.ca>
1 parent 1635c49 commit dbe300b

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ summary:
2020
@echo "zero-deployable-react-frontend:"
2121
@echo "- Repository URL: ${REPOSITORY}"
2222
@echo "- Deployment Pipeline URL: https://app.circleci.com/pipelines/github/${GITHUB_ORG}/${GITHUB_REPO}"
23-
@echo $(shell echo ${ENVIRONMENT} | grep production > /dev/null && echo "- Production Landing Page: ${productionFrontendSubdomain}${productionHostRoot}")
24-
@echo $(shell echo ${ENVIRONMENT} | grep staging > /dev/null && echo "- Staging Landing Page: ${stagingFrontendSubdomain}${stagingHostRoot}")
23+
@echo $(shell echo ${ENVIRONMENT} | grep prod > /dev/null && echo "- Production Landing Page: ${productionFrontendSubdomain}${productionHostRoot}")
24+
@echo $(shell echo ${ENVIRONMENT} | grep stage > /dev/null && echo "- Staging Landing Page: ${stagingFrontendSubdomain}${stagingHostRoot}")
2525

zero-module.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,44 @@ parameters:
2727
- "us-east-2"
2828
- field: productionHostRoot
2929
label: Production Root Host Name (e.g. mydomain.com) - this must be the root of the chosen domain, not a subdomain.
30+
fieldValidation:
31+
type: regex
32+
value: '^([a-z0-9]+(-[a-z0-9]+)*\.{1})+[a-z]{2,}$'
33+
errorMessage: Invalid root domain name
3034
- field: productionFrontendSubdomain
3135
label: Production Frontend Host Name (e.g. app.)
3236
default: app.
37+
fieldValidation:
38+
type: regex
39+
value: '^([a-z0-9]+(-[a-z0-9]+)*\.)$'
40+
errorMessage: Invalid subdomain (cannot contain special chars & must end with a '.')
3341
- field: productionBackendSubdomain
3442
label: Production Backend Host Name (e.g. api.)
3543
default: api.
44+
fieldValidation:
45+
type: regex
46+
value: '^([a-z0-9]+(-[a-z0-9]+)*\.)$'
47+
errorMessage: Invalid subdomain (cannot contain special chars & must end with a '.')
3648
- field: stagingHostRoot
3749
label: Staging Root Host Name (e.g. mydomain-staging.com) - this must be the root of the chosen domain, not a subdomain.
50+
fieldValidation:
51+
type: regex
52+
value: '^([a-z0-9]+(-[a-z0-9]+)*\.{1})+[a-z]{2,}$'
53+
errorMessage: Invalid root domain name
3854
- field: stagingFrontendSubdomain
3955
label: Staging Frontend Host Name (e.g. app.)
4056
default: app.
57+
fieldValidation:
58+
type: regex
59+
value: '^([a-z0-9]+(-[a-z0-9]+)*\.)$'
60+
errorMessage: Invalid subdomain (cannot contain special chars & must end with a '.')
4161
- field: stagingBackendSubdomain
4262
label: Staging Backend Host Name (e.g. api.)
4363
default: api.
64+
fieldValidation:
65+
type: regex
66+
value: '^([a-z0-9]+(-[a-z0-9]+)*\.)$'
67+
errorMessage: Invalid subdomain (cannot contain special chars & must end with a '.')
4468
- field: randomSeed
4569
label: Random seed that will be shared between projects to come up with deterministic resource names
4670
execute: uuidgen | head -c 8

0 commit comments

Comments
 (0)