Skip to content

Commit

Permalink
Added schema validation for configs
Browse files Browse the repository at this point in the history
  • Loading branch information
mrvautin committed Jan 10, 2018
1 parent 2e2e4b3 commit aabf6c4
Show file tree
Hide file tree
Showing 11 changed files with 620 additions and 3,625 deletions.
108 changes: 108 additions & 0 deletions config/baseSchema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"properties": {
"cartTitle": {
"type": "string",
"default": "expressCart"
},
"cartDescription": {
"type": "string",
"default": "This is my expressCart"
},
"cartLogo": {
"type": "string"
},
"baseUrl": {
"type": "string",
"format": "uri-template",
"default": "http://localhost:1111"
},
"emailHost": {
"format": "uri-template",
"type": "string"
},
"emailPort": {
"type": "number",
"default": 587
},
"emailSecure": {
"type": "boolean",
"default": false
},
"emailUser": {
"type": "string"
},
"emailPassword": {
"type": "string"
},
"emailAddress": {
"type": "string",
"format": "email"
},
"menuEnabled": {
"type": "boolean",
"default": true
},
"flatShipping": {
"type": "number",
"default": 10
},
"freeShippingAmount": {
"type": "number",
"default": 100
},
"productsPerRow": {
"type": "number",
"default": 3
},
"productsPerPage": {
"type": "number",
"default": 6
},
"menuTitle": {
"type": "string",
"default": "Menu"
},
"menuLocation": {
"type": "string",
"default": "side",
"enum": ["top", "side"]
},
"footerHtml": {
"type": "string",
"default": "<h4 class="text-center">Powered by expressCart</h4>"
},
"googleAnalytics": {
"type": "string"
},
"customCss": {
"type": "string"
},
"currencySymbol": {
"type": "string",
"default": "£"
},
"paymentGateway": {
"type": "string",
"enum": ["paypal", "stripe"]
},
"databaseConnectionString": {
"format": "uri-template",
"type": "string"
},
"theme": {
"type": "string"
}
},
"required": [
"baseUrl",
"emailHost",
"emailPort",
"emailSecure",
"emailUser",
"emailPassword",
"emailAddress",
"paymentGateway",
"databaseConnectionString"
],
"additionalProperties": false
}
28 changes: 28 additions & 0 deletions config/paypalSchema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"properties": {
"mode": {
"type": "string",
"enum": ["sandbox", "live"]
},
"client_id": {
"type": "string"
},
"client_secret": {
"type": "string"
},
"paypalCartDescription": {
"type": "string"
},
"paypalCurrency": {
"type": "string"
}
},
"required": [
"mode",
"client_id",
"client_secret",
"paypalCartDescription",
"paypalCurrency"
],
"additionalProperties": false
}
16 changes: 8 additions & 8 deletions config/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
"cartLogo": "",
"baseUrl": "http://localhost:1111",
"emailHost": "smtp-mail.outlook.com",
"emailPort": "587",
"emailPort": 587,
"emailSecure": false,
"emailUser": "hi@markmoffat.com",
"emailPassword": "this_is_the_smtp_password",
"emailAddress": "hi@markmoffat.com",
"menuEnabled": "true",
"flatShipping": "10",
"freeShippingAmount": "100",
"productsPerRow": "3",
"productsPerPage": "6",
"menuEnabled": true,
"flatShipping": 10,
"freeShippingAmount": 100,
"productsPerRow": 3,
"productsPerPage": 6,
"menuTitle": "Menu",
"menuLocation": "side",
"footerHtml": "<h4 class="text-center">Powered by expressCart</h4>",
"googleAnalytics": "",
"customCss": ".footer{padding-top: 5px;}",
"currencySymbol": "£",
"paymentGateway": "paypal",
"databaseConnectionString": "mongodb://localhost:27017/expresscart",
"paymentGateway": "stripe",
"databaseConnectionString": "mongodb://expresscart:test@ds139909.mlab.com:39909/expresscart",
"theme": "Cloth"
}
2 changes: 1 addition & 1 deletion config/stripe.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"secretKey": "sk_test_this_is_not_real",
"publicKey": "pk_test_this_is_not_real",
"stripeCurrency": "aud",
"stripeCurrency": "usd",
"stripeDescription": "expressCart payment",
"stripeLogoURL": "http://localhost:1111/images/stripelogo.png"
}
29 changes: 29 additions & 0 deletions config/stripeSchema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"properties": {
"secretKey": {
"type": "string",
"default": "sandbox"
},
"publicKey": {
"type": "string"
},
"stripeCurrency": {
"type": "string"
},
"stripeDescription": {
"type": "string"
},
"stripeLogoURL": {
"type": "string",
"format": "uri-template"
}
},
"required": [
"secretKey",
"publicKey",
"stripeCurrency",
"stripeDescription",
"stripeLogoURL"
],
"additionalProperties": false
}
Loading

0 comments on commit aabf6c4

Please sign in to comment.