mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Merge pull request #229 from zoff-music/fix/errors-missing-configs
Added more error-messages on crashing because of missing files.
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
var path = require('path');
|
||||
try {
|
||||
var mongo_config = require(path.join(path.join(__dirname, '../config/'), 'mongo_config.js'));
|
||||
} catch(e) {
|
||||
console.log("Error - missing file");
|
||||
console.log("Seems you forgot to create the file mongo_config.js in /server/config/. Have a look at mongo_config.example.js.");
|
||||
process.exit();
|
||||
}
|
||||
var mongojs = require('mongojs');
|
||||
var db = mongojs(mongo_config.config);
|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
var path = require('path');
|
||||
var time_regex = /P((([0-9]*\.?[0-9]*)Y)?(([0-9]*\.?[0-9]*)M)?(([0-9]*\.?[0-9]*)W)?(([0-9]*\.?[0-9]*)D)?)?(T(([0-9]*\.?[0-9]*)H)?(([0-9]*\.?[0-9]*)M)?(([0-9]*\.?[0-9]*)S)?)?/;
|
||||
try {
|
||||
var key = require(path.join(__dirname, '../config/api_key.js'));
|
||||
} catch(e) {
|
||||
console.log("Error - missing file");
|
||||
console.log("Seems you forgot to create the file api_key.js in /server/config/. Have a look at api_key.example.js.");
|
||||
process.exit();
|
||||
}
|
||||
|
||||
function get_correct_info(song_generated, channel, broadcast) {
|
||||
request({
|
||||
|
||||
@@ -8,7 +8,7 @@ pathThumbnails = __dirname;
|
||||
var express = require('express');
|
||||
var app = express();
|
||||
var exphbs = require('express-handlebars');
|
||||
var cert_config = require(path.join(path.join(__dirname, 'config'), 'cert_config.js'));
|
||||
|
||||
var hbs = exphbs.create({
|
||||
defaultLayout: publicPath + '/layouts/main',
|
||||
layoutsDir: publicPath + '/layouts',
|
||||
@@ -23,6 +23,7 @@ app.enable('view cache');
|
||||
app.set('views', publicPath);
|
||||
|
||||
try{
|
||||
var cert_config = require(path.join(path.join(__dirname, 'config'), 'cert_config.js'));
|
||||
var fs = require('fs');
|
||||
var privateKey = fs.readFileSync(cert_config.privateKey).toString();
|
||||
var certificate = fs.readFileSync(cert_config.certificate).toString();
|
||||
|
||||
@@ -2,10 +2,14 @@ var express = require('express');
|
||||
var router = express.Router();
|
||||
var path = require('path');
|
||||
var nodemailer = require('nodemailer');
|
||||
try {
|
||||
var mailconfig = require(path.join(__dirname, '../config/mailconfig.js'));
|
||||
var mongo_db_cred = {config: 'mydb'};
|
||||
var mongojs = require('mongojs');
|
||||
var db = mongojs(mongo_db_cred.config);
|
||||
} catch(e) {
|
||||
console.log("Error - missing file");
|
||||
console.log("Seems you forgot to create a mailconfig.js in /server/config/. Have a look at the mailconfig.example.js.");
|
||||
process.exit();
|
||||
}
|
||||
|
||||
|
||||
router.use(function(req, res, next) {
|
||||
next(); // make sure we go to the next routes and don't stop here
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
var express = require('express');
|
||||
var router = express.Router();
|
||||
var path = require('path');
|
||||
var mongo_db_cred = {config: 'mydb'};
|
||||
var mongojs = require('mongojs');
|
||||
var db = mongojs(mongo_db_cred.config);
|
||||
|
||||
router.use(function(req, res, next) {
|
||||
next(); // make sure we go to the next routes and don't stop here
|
||||
|
||||
Reference in New Issue
Block a user