Skip to content

Commit

Permalink
Merge pull request #119 from dadi/feature/partial-path-array
Browse files Browse the repository at this point in the history
Allow array of paths for partials
  • Loading branch information
David Longworth authored Feb 13, 2017
2 parents e2bec3e + 5b35f73 commit e982d51
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 135 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<img src="http://52.209.207.148/assets/products/dadi-web-full.png" alt="DADI Web" height="65"/>

[![npm (scoped)](https://img.shields.io/npm/v/@dadi/web.svg?maxAge=10800&style=flat-square)](https://www.npmjs.com/package/@dadi/web)
[![coverage](https://img.shields.io/badge/coverage-63%25-yellow.svg?style=flat-square)](https://github.com/dadi/web)
[![coverage](https://img.shields.io/badge/coverage-64%25-yellow.svg?style=flat-square)](https://github.com/dadi/web)
[![Build Status](https://travis-ci.org/dadi/web.svg?branch=master)](https://travis-ci.org/dadi/web)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release)
Expand Down
10 changes: 2 additions & 8 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,22 +489,16 @@ var conf = convict({
cluster: {
doc: 'If true, Web runs in cluster mode, starting a worker for each CPU core',
format: Boolean,
default: false
default: true
},
debug: {
doc: 'If true, debug mode is enabled and a panel containing the JSON loaded for each page is displayed alongside the normal content.',
format: Boolean,
default: false
},
secret: {
doc: 'A value that must be passed to requests for the /config route, which allows viewing the application config in the browser',
format: String,
default: '1dc10073-ca36-4373-a646-0d1092caf4a5',
env: 'CONFIG_SECRET'
},
data: {
preload: {
doc: '',
doc: 'An array of datasources to load at startup',
format: Array,
default: []
}
Expand Down
3 changes: 2 additions & 1 deletion dadi/lib/api/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var _ = require('underscore')
var debug = require('debug')('web:api')
var fs = require('fs')
var http = require('http')
var https = require('https')
Expand Down Expand Up @@ -108,7 +109,7 @@ Api.prototype.use = function (path, handler) {
regex: regex
})

log.warn({module: 'api'}, 'Loaded ' + path)
debug('loaded %s', path)

this.paths.sort((a, b) => {
return b.order - a.order
Expand Down
3 changes: 1 addition & 2 deletions dadi/lib/cache/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* @module Cache
*/
var _ = require('underscore')
var crypto = require('crypto')
var path = require('path')
var url = require('url')
var _ = require('underscore')

var config = require(path.join(__dirname, '/../../../config.js'))
var log = require('@dadi/logger')
Expand All @@ -18,7 +18,6 @@ var cache = new DadiCache(config.get('caching'))
* @param {Server} server - the main server instance
*/
var Cache = function (server) {
log.info({module: 'cache'}, 'Cache logging started.')
this.server = server
this.enabled = config.get('caching.directory.enabled') || config.get('caching.redis.enabled')
this.encoding = 'utf8'
Expand Down
5 changes: 2 additions & 3 deletions dadi/lib/controller/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ REWRITE INFO:
https://github.com/tinganho/connect-modrewrite
*/
var _ = require('underscore')
var debug = require('debug')('web:router')
var es = require('event-stream')
var fs = require('fs')
var path = require('path')
Expand All @@ -22,8 +23,6 @@ var RouteValidator = require(path.join(__dirname, '../datasource/route-validator
var rewriteFunction = null

var Router = function (server, options) {
log.info({module: 'router'}, 'Router logging started.')

this.data = {}
this.params = {}
this.constraints = {}
Expand Down Expand Up @@ -149,7 +148,7 @@ Router.prototype.constrain = function (route, constraint) {
// add constraint from /{routesPath}/constraints.js if it exists
if (this.handlers[constraint]) {
this.constraints[route] = this.handlers[constraint]
log.info({module: 'router'}, "Added route constraint function '%s' for '%s'", constraint, route)
debug('added route constraint function "%s" for %s', constraint, route)
} else {
var error = "Route constraint '" + constraint + "' not found. Is it defined in '" + this.options.routesPath + "/constraints.js'?"
var err = new Error(error)
Expand Down
2 changes: 2 additions & 0 deletions dadi/lib/dust/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const debug = require('debug')('web:dust')
const dust = require('dustjs-linkedin')
const fs = require('fs')
const mkdirp = require('mkdirp')
Expand Down Expand Up @@ -63,6 +64,7 @@ Dust.prototype.load = function (source, templateName) {
}

Dust.prototype.loadDirectory = function (directory, prefix, recursive) {
debug('loadDirectory %o %s %s', directory, prefix, recursive)
prefix = prefix || ''

return new Promise((resolve, reject) => {
Expand Down
Loading

0 comments on commit e982d51

Please sign in to comment.