2015-06-14 23:04:49 +02:00
|
|
|
//configuration.js
|
|
|
|
var fs = require('fs');
|
|
|
|
|
|
|
|
//Function for loading and returning the settings.json file, makes one if there isn't one.
|
|
|
|
module.exports = function () {
|
2015-06-16 15:26:12 +02:00
|
|
|
if (!fs.existsSync(__dirname + '/settings.json')) {
|
|
|
|
//Template for settings.json if not available.
|
|
|
|
var settings = {
|
|
|
|
'env' : 'dev',
|
|
|
|
'database' : 'example.com/database',
|
|
|
|
'web_port' : 1024,
|
|
|
|
'amount_of_hours' : 7,
|
|
|
|
'hour_times' : [
|
|
|
|
'8:45 - 9:45',
|
|
|
|
'9:45 - 10:45',
|
|
|
|
'11:10 - 12:10',
|
|
|
|
'12:10 - 13:10',
|
|
|
|
'13:40 - 14:40',
|
|
|
|
'14:40 - 15:40',
|
|
|
|
'15:40 - 16:40'
|
|
|
|
],
|
|
|
|
'school_id' : 934,
|
|
|
|
'links' : {
|
|
|
|
'Login': ['#', '#96AA48'],
|
|
|
|
'Magister': ['http://werkman.magister.net', '#0C5489'],
|
|
|
|
'Mail': ['https://login.microsoftonline.com/', '#C41824']
|
2015-06-24 16:42:09 +02:00
|
|
|
},
|
|
|
|
'spider_timeout' : 1000
|
2015-06-14 23:59:43 +02:00
|
|
|
}
|
2015-06-23 11:55:36 +02:00
|
|
|
fs.writeFileSync(__dirname + '/settings.json', JSON.stringify(settings, null, 2)); //Write it to file as prettyprinted json.
|
2015-06-14 23:04:49 +02:00
|
|
|
|
2015-06-16 15:26:12 +02:00
|
|
|
return settings;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return JSON.parse(fs.readFileSync(__dirname + '/settings.json'));
|
|
|
|
}
|
2015-06-14 23:04:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (process.argv[2] == 'test') {
|
2015-06-16 15:26:12 +02:00
|
|
|
console.log(module.exports());
|
2015-06-14 23:04:49 +02:00
|
|
|
}
|