mirror of
https://github.com/pa11y/pa11y-dashboard.git
synced 2025-09-24 14:21:13 +00:00
Allow the webservice to run automatically
This commit is contained in:
7
app.js
7
app.js
@@ -13,11 +13,16 @@ module.exports = initApp;
|
||||
function initApp (config, callback) {
|
||||
config = defaultConfig(config);
|
||||
|
||||
var webserviceUrl = config.webservice;
|
||||
if (typeof webserviceUrl == 'object') {
|
||||
webserviceUrl = 'http://' + webserviceUrl.host + ':' + webserviceUrl.port + '/';
|
||||
}
|
||||
|
||||
var app = new EventEmitter();
|
||||
app.address = null;
|
||||
app.express = express();
|
||||
app.server = http.createServer(app.express);
|
||||
app.webservice = createClient(config.webservice);
|
||||
app.webservice = createClient(webserviceUrl);
|
||||
|
||||
// Compression
|
||||
app.express.use(express.compress());
|
||||
|
@@ -2,5 +2,12 @@
|
||||
"webservice": "http://localhost:3000/",
|
||||
"port": 4000,
|
||||
"noindex": true,
|
||||
"readonly": false
|
||||
"readonly": false,
|
||||
|
||||
"webservice": {
|
||||
"database": "mongodb://localhost/pa11y-webservice-dev",
|
||||
"host": "0.0.0.0",
|
||||
"port": 3000,
|
||||
"cron": "0 30 0 * * *"
|
||||
}
|
||||
}
|
@@ -1,6 +1,12 @@
|
||||
{
|
||||
"webservice": "http://localhost:3000/",
|
||||
"port": 4000,
|
||||
"noindex": true,
|
||||
"readonly": false
|
||||
"readonly": false,
|
||||
|
||||
"webservice": {
|
||||
"database": "mongodb://localhost/pa11y-webservice",
|
||||
"host": "0.0.0.0",
|
||||
"port": 3000,
|
||||
"cron": "0 30 0 * * *"
|
||||
}
|
||||
}
|
10
index.js
10
index.js
@@ -18,4 +18,14 @@ require('./app')(config, function (err, app) {
|
||||
console.error(chalk.grey(stack.join('\n')));
|
||||
});
|
||||
|
||||
// Start the webservice if required
|
||||
if (typeof config.webservice === 'object') {
|
||||
require('pa11y-webservice')(config.webservice, function (err, webservice) {
|
||||
console.log('');
|
||||
console.log(chalk.underline.cyan('pa11y-webservice started'));
|
||||
console.log(chalk.grey('mode: %s'), process.env.NODE_ENV);
|
||||
console.log(chalk.grey('uri: %s'), webservice.server.info.uri);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
@@ -25,6 +25,7 @@
|
||||
"express": "~3.4",
|
||||
"express-hbs": "~0.2",
|
||||
"moment": "~2.2",
|
||||
"pa11y-webservice": "~1.1",
|
||||
"pa11y-webservice-client-node": "~1.0",
|
||||
"underscore": "~1.5"
|
||||
},
|
||||
|
Reference in New Issue
Block a user