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": "",
|
||||
"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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
},
|
||||
"dependencies": {
|
||||
"ajv": "^6.0.0",
|
||||
"async": "^2.6.0",
|
||||
"bcrypt-nodejs": "0.0.3",
|
||||
"body-parser": "^1.17.2",
|
||||
|
@ -25,6 +26,7 @@
|
|||
"lunr": "^2.1.5",
|
||||
"moment": "^2.15.2",
|
||||
"mongodb": "^3.0.1",
|
||||
"mongodb-uri": "^0.9.7",
|
||||
"morgan": "^1.9.0",
|
||||
"multer": "^1.1.0",
|
||||
"nodemailer": "^4.4.1",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="row">
|
||||
<form action="/search" id="search_form" method="post">
|
||||
<div class="row">
|
||||
{{#ifCond config.menuEnabled '==' "true"}}
|
||||
{{#ifCond config.menuEnabled '==' 'true'}}
|
||||
{{#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">
|
||||
{{else}}
|
||||
|
@ -23,7 +23,7 @@
|
|||
</form>
|
||||
</div>
|
||||
<div class="row">
|
||||
{{#ifCond config.menuEnabled '==' "true"}}
|
||||
{{#ifCond config.menuEnabled '==' 'true'}}
|
||||
{{#ifCond config.menuLocation '==' "side"}}
|
||||
<div class="col-xl-3 col-md-2">
|
||||
<ul class="list-group menu-side">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="col-xl-8 col-xl-offset-2 col-xs-12">
|
||||
<div class="row">
|
||||
<form>
|
||||
{{#ifCond config.menuEnabled '==' "true"}}
|
||||
{{#ifCond config.menuEnabled '==' 'true'}}
|
||||
{{#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">
|
||||
{{else}}
|
||||
|
@ -21,7 +21,7 @@
|
|||
</form>
|
||||
</div>
|
||||
<div class="row">
|
||||
{{#ifCond config.menuEnabled '==' "true"}}
|
||||
{{#ifCond config.menuEnabled '==' 'true'}}
|
||||
{{#ifCond config.menuLocation '==' "side"}}
|
||||
<div class="col-xl-3 col-md-2">
|
||||
<ul class="list-group menu-side">
|
||||
|
@ -78,7 +78,7 @@
|
|||
</h3>
|
||||
</a>
|
||||
</div>
|
||||
{{else}}
|
||||
{{else}}
|
||||
<a href="/product/{{this._id}}">
|
||||
<div class="vertical-center thumbnail-image-container">
|
||||
{{#if productImage}}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="row">
|
||||
<form action="/search" id="search_form" method="post">
|
||||
<div class="row">
|
||||
{{#ifCond config.menuEnabled '==' "true"}}
|
||||
{{#ifCond config.menuEnabled '==' 'true'}}
|
||||
{{#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">
|
||||
{{else}}
|
||||
|
@ -23,7 +23,7 @@
|
|||
</form>
|
||||
</div>
|
||||
<div class="row">
|
||||
{{#ifCond config.menuEnabled '==' "true"}}
|
||||
{{#ifCond config.menuEnabled '==' 'true'}}
|
||||
{{#ifCond config.menuLocation '==' "side"}}
|
||||
<div class="col-xl-3 col-md-2">
|
||||
<ul class="list-group menu-side">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class="col-xl-8 col-xl-offset-2 col-xs-12">
|
||||
<div class="row">
|
||||
{{#ifCond config.menuEnabled '==' "true"}}
|
||||
{{#ifCond config.menuEnabled '==' 'true'}}
|
||||
{{#ifCond config.menuLocation '==' "side"}}
|
||||
<div class="col-xl-3 col-md-2">
|
||||
<ul class="list-group menu-side">
|
||||
|
@ -92,13 +92,13 @@
|
|||
{{{productDescription}}}
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6 pull-left">
|
||||
<div class="col-xs-12 col-md-6 pull-left">
|
||||
{{#if result.productImage}}
|
||||
<div class="title-image-container">
|
||||
<div class="image-prev image-button"> <i class="fa fa-chevron-left" aria-hidden="true"></i></div>
|
||||
<img src="{{result.productImage}}" id="product-title-image" class="product-title-image img-responsive" alt="...">
|
||||
<div class="image-next image-button"> <i class="fa fa-chevron-right" aria-hidden="true"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="title-image-container">
|
||||
<img src="/uploads/placeholder.png" id="product-title-image" class="product-title-image img-responsive" alt="...">
|
||||
|
@ -106,16 +106,16 @@
|
|||
{{/if}}
|
||||
{{#ifCond images.length '>' 1}}
|
||||
<div class="row">
|
||||
{{#each images}}
|
||||
{{#each images}}
|
||||
<div class="vertical-center top-pad-20 col-xs-6 col-lg-6 col-xl-6">
|
||||
<img src="{{this.path}}" class="thumbnail-image img-responsive">
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/ifCond}}
|
||||
{{/ifCond}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="productId" value="{{result._id}}">
|
||||
|
|
Loading…
Reference in New Issue