mirror of
https://github.com/zoriya/flood.git
synced 2026-06-05 19:54:18 +00:00
Use user-defined config based on supplied template
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
.DS_Store
|
||||
config.js
|
||||
node_modules
|
||||
npm-debug.log
|
||||
server/assets
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
const config = {
|
||||
dbCleanInterval: 1000 * 60 * 60,
|
||||
dbPath: './server/db/',
|
||||
floodServerPort: 3000,
|
||||
maxHistoryStates: 30,
|
||||
pollInterval: 1000 * 5,
|
||||
secret: 'flood',
|
||||
scgi: {
|
||||
host: 'localhost',
|
||||
port: 5000,
|
||||
socket: false,
|
||||
socketPath: '/tmp/rtorrent.sock'
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
+13
-4
@@ -1,10 +1,19 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
// Ensure we have a user-defined config.js for use throughout the app.
|
||||
try {
|
||||
let fs = require('fs');
|
||||
fs.accessSync('./config.js', fs.F_OK);
|
||||
} catch (e) {
|
||||
console.error('Cannot start Flood server, config.js is missing. Copy ' +
|
||||
'config.template.js to config.js.');
|
||||
return;
|
||||
}
|
||||
|
||||
var app = require('../app');
|
||||
let config = require('../../config');
|
||||
var debug = require('debug')('flood:server');
|
||||
var http = require('http');
|
||||
|
||||
@@ -12,7 +21,7 @@ var http = require('http');
|
||||
* Get port from environment and store in Express.
|
||||
*/
|
||||
|
||||
var port = normalizePort(process.env.PORT || '3000');
|
||||
var port = normalizePort(config.floodServerPort);
|
||||
app.set('port', port);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user