Move loading of config in master to startServer

Move the loading of the config file in the master server to the
startServer function.  Remove config.json.test as it's no longer needed.
This commit is contained in:
Hornwitser committed 2019-09-04 20:43:13 +02:00
1 parent 651b09b613
commit 35546b4b18
4 files changed
+14 -53

No files matched your search

+9 -4
View File
@@ -5,17 +5,22 @@ const parallel = require('mocha.parallel');
const jwt = require("jsonwebtoken");
const master = require('./master.js');
const config = require('./config.json');
const authenticate = require('lib/authenticate');
const database = require('lib/database');
authenticate.setAuthSecret(config.masterAuthSecret);
master._db.slaves = new Map();
master._db.items = new database.ItemDatabase();
const token =
jwt.sign( { id: "api" }, config.masterAuthSecret, { expiresIn: 600 });
// Fields required in the config
master._config.factorioDirectory = "factorio";
master._config.itemStats = { maxEntries:60, entriesPerSecond: 1 / 60 };
master._config.disableFairItemDistribution = true;
const testSecret = "TestSecretDoNotUse";
authenticate.setAuthSecret(testSecret);
const token = jwt.sign({ id: "api" }, testSecret, { expiresIn: 600 });
async function get(path) {
return await request(master.app).get(path).expect(200);