Added schema validation for configs
parent
2e2e4b3834
commit
aabf6c44e3
|
@ -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
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -4,23 +4,23 @@
|
||||||
"cartLogo": "",
|
"cartLogo": "",
|
||||||
"baseUrl": "http://localhost:1111",
|
"baseUrl": "http://localhost:1111",
|
||||||
"emailHost": "smtp-mail.outlook.com",
|
"emailHost": "smtp-mail.outlook.com",
|
||||||
"emailPort": "587",
|
"emailPort": 587,
|
||||||
"emailSecure": false,
|
"emailSecure": false,
|
||||||
"emailUser": "hi@markmoffat.com",
|
"emailUser": "hi@markmoffat.com",
|
||||||
"emailPassword": "this_is_the_smtp_password",
|
"emailPassword": "this_is_the_smtp_password",
|
||||||
"emailAddress": "hi@markmoffat.com",
|
"emailAddress": "hi@markmoffat.com",
|
||||||
"menuEnabled": "true",
|
"menuEnabled": true,
|
||||||
"flatShipping": "10",
|
"flatShipping": 10,
|
||||||
"freeShippingAmount": "100",
|
"freeShippingAmount": 100,
|
||||||
"productsPerRow": "3",
|
"productsPerRow": 3,
|
||||||
"productsPerPage": "6",
|
"productsPerPage": 6,
|
||||||
"menuTitle": "Menu",
|
"menuTitle": "Menu",
|
||||||
"menuLocation": "side",
|
"menuLocation": "side",
|
||||||
"footerHtml": "<h4 class="text-center">Powered by expressCart</h4>",
|
"footerHtml": "<h4 class="text-center">Powered by expressCart</h4>",
|
||||||
"googleAnalytics": "",
|
"googleAnalytics": "",
|
||||||
"customCss": ".footer{padding-top: 5px;}",
|
"customCss": ".footer{padding-top: 5px;}",
|
||||||
"currencySymbol": "£",
|
"currencySymbol": "£",
|
||||||
"paymentGateway": "paypal",
|
"paymentGateway": "stripe",
|
||||||
"databaseConnectionString": "mongodb://localhost:27017/expresscart",
|
"databaseConnectionString": "mongodb://expresscart:test@ds139909.mlab.com:39909/expresscart",
|
||||||
"theme": "Cloth"
|
"theme": "Cloth"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"secretKey": "sk_test_this_is_not_real",
|
"secretKey": "sk_test_this_is_not_real",
|
||||||
"publicKey": "pk_test_this_is_not_real",
|
"publicKey": "pk_test_this_is_not_real",
|
||||||
"stripeCurrency": "aud",
|
"stripeCurrency": "usd",
|
||||||
"stripeDescription": "expressCart payment",
|
"stripeDescription": "expressCart payment",
|
||||||
"stripeLogoURL": "http://localhost:1111/images/stripelogo.png"
|
"stripeLogoURL": "http://localhost:1111/images/stripelogo.png"
|
||||||
}
|
}
|
|
@ -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
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -8,6 +8,7 @@
|
||||||
"deploy": "gulp deploy"
|
"deploy": "gulp deploy"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"ajv": "^6.0.0",
|
||||||
"async": "^2.6.0",
|
"async": "^2.6.0",
|
||||||
"bcrypt-nodejs": "0.0.3",
|
"bcrypt-nodejs": "0.0.3",
|
||||||
"body-parser": "^1.17.2",
|
"body-parser": "^1.17.2",
|
||||||
|
@ -25,6 +26,7 @@
|
||||||
"lunr": "^2.1.5",
|
"lunr": "^2.1.5",
|
||||||
"moment": "^2.15.2",
|
"moment": "^2.15.2",
|
||||||
"mongodb": "^3.0.1",
|
"mongodb": "^3.0.1",
|
||||||
|
"mongodb-uri": "^0.9.7",
|
||||||
"morgan": "^1.9.0",
|
"morgan": "^1.9.0",
|
||||||
"multer": "^1.1.0",
|
"multer": "^1.1.0",
|
||||||
"nodemailer": "^4.4.1",
|
"nodemailer": "^4.4.1",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<form action="/search" id="search_form" method="post">
|
<form action="/search" id="search_form" method="post">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{#ifCond config.menuEnabled '==' "true"}}
|
{{#ifCond config.menuEnabled '==' 'true'}}
|
||||||
{{#ifCond config.menuLocation '==' "side"}}
|
{{#ifCond config.menuLocation '==' "side"}}
|
||||||
<div class="col-md-offset-2 col-lg-offset-2 col-xl-9 col-xl-offset-3 search-bar col-md-10 search-bar">
|
<div class="col-md-offset-2 col-lg-offset-2 col-xl-9 col-xl-offset-3 search-bar col-md-10 search-bar">
|
||||||
{{else}}
|
{{else}}
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{#ifCond config.menuEnabled '==' "true"}}
|
{{#ifCond config.menuEnabled '==' 'true'}}
|
||||||
{{#ifCond config.menuLocation '==' "side"}}
|
{{#ifCond config.menuLocation '==' "side"}}
|
||||||
<div class="col-xl-3 col-md-2">
|
<div class="col-xl-3 col-md-2">
|
||||||
<ul class="list-group menu-side">
|
<ul class="list-group menu-side">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div class="col-xl-8 col-xl-offset-2 col-xs-12">
|
<div class="col-xl-8 col-xl-offset-2 col-xs-12">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<form>
|
<form>
|
||||||
{{#ifCond config.menuEnabled '==' "true"}}
|
{{#ifCond config.menuEnabled '==' 'true'}}
|
||||||
{{#ifCond config.menuLocation '==' "side"}}
|
{{#ifCond config.menuLocation '==' "side"}}
|
||||||
<div class="col-md-offset-2 col-lg-offset-2 col-xl-9 col-xl-offset-3 search-bar col-md-10 search-bar">
|
<div class="col-md-offset-2 col-lg-offset-2 col-xl-9 col-xl-offset-3 search-bar col-md-10 search-bar">
|
||||||
{{else}}
|
{{else}}
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{#ifCond config.menuEnabled '==' "true"}}
|
{{#ifCond config.menuEnabled '==' 'true'}}
|
||||||
{{#ifCond config.menuLocation '==' "side"}}
|
{{#ifCond config.menuLocation '==' "side"}}
|
||||||
<div class="col-xl-3 col-md-2">
|
<div class="col-xl-3 col-md-2">
|
||||||
<ul class="list-group menu-side">
|
<ul class="list-group menu-side">
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<form action="/search" id="search_form" method="post">
|
<form action="/search" id="search_form" method="post">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{#ifCond config.menuEnabled '==' "true"}}
|
{{#ifCond config.menuEnabled '==' 'true'}}
|
||||||
{{#ifCond config.menuLocation '==' "side"}}
|
{{#ifCond config.menuLocation '==' "side"}}
|
||||||
<div class="col-md-offset-2 col-lg-offset-2 col-xl-9 col-xl-offset-3 search-bar col-md-10 search-bar">
|
<div class="col-md-offset-2 col-lg-offset-2 col-xl-9 col-xl-offset-3 search-bar col-md-10 search-bar">
|
||||||
{{else}}
|
{{else}}
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{#ifCond config.menuEnabled '==' "true"}}
|
{{#ifCond config.menuEnabled '==' 'true'}}
|
||||||
{{#ifCond config.menuLocation '==' "side"}}
|
{{#ifCond config.menuLocation '==' "side"}}
|
||||||
<div class="col-xl-3 col-md-2">
|
<div class="col-xl-3 col-md-2">
|
||||||
<ul class="list-group menu-side">
|
<ul class="list-group menu-side">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="col-xl-8 col-xl-offset-2 col-xs-12">
|
<div class="col-xl-8 col-xl-offset-2 col-xs-12">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{#ifCond config.menuEnabled '==' "true"}}
|
{{#ifCond config.menuEnabled '==' 'true'}}
|
||||||
{{#ifCond config.menuLocation '==' "side"}}
|
{{#ifCond config.menuLocation '==' "side"}}
|
||||||
<div class="col-xl-3 col-md-2">
|
<div class="col-xl-3 col-md-2">
|
||||||
<ul class="list-group menu-side">
|
<ul class="list-group menu-side">
|
||||||
|
|
Loading…
Reference in New Issue