mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Renamed server->backend in configuration files
This commit is contained in:
parent
57a700d2d2
commit
9e1503c106
@ -296,14 +296,14 @@ void Server::task()
|
||||
ss << ifstream.rdbuf();
|
||||
std::error_code errorCode;
|
||||
json::value config = json::value::parse(ss.str(), errorCode);
|
||||
if (config.is_object() && config.has_object_field(L"server") &&
|
||||
config[L"server"].has_string_field(L"address") && config[L"server"].has_number_field(L"port"))
|
||||
if (config.is_object() && config.has_object_field(L"backend") &&
|
||||
config[L"backend"].has_string_field(L"address") && config[L"backend"].has_number_field(L"port"))
|
||||
{
|
||||
address = "http://" + to_string(config[L"server"][L"address"]) + ":" + to_string(config[L"server"][L"port"].as_number().to_int32());
|
||||
log("Starting server on " + address);
|
||||
address = "http://" + to_string(config[L"backend"][L"address"]) + ":" + to_string(config[L"backend"][L"port"].as_number().to_int32());
|
||||
log("Starting backend on " + address);
|
||||
}
|
||||
else
|
||||
log("Error reading configuration file. Starting server on " + address);
|
||||
log("Error reading configuration file. Starting backend on " + address);
|
||||
|
||||
if (config.is_object() && config.has_object_field(L"authentication"))
|
||||
{
|
||||
|
||||
@ -33,7 +33,7 @@ module.exports = function (configLocation) {
|
||||
|
||||
/* Define middleware */
|
||||
app.use(logger('dev'));
|
||||
app.use('/olympus', createProxyMiddleware({ target: `http://${config["server"]["address"]}:${config["server"]["port"]}`, changeOrigin: true }));
|
||||
app.use('/olympus', createProxyMiddleware({ target: `http://${config["backend"]["address"]}:${config["backend"]["port"]}`, changeOrigin: true }));
|
||||
app.use(bodyParser.json({ limit: '50mb' }));
|
||||
app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }));
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
|
||||
@ -36,11 +36,11 @@ var http = require('http');
|
||||
*/
|
||||
|
||||
var configPort = null;
|
||||
if (config["server"] != undefined && config["server"]["port"] != undefined) {
|
||||
configPort = config["server"]["port"];
|
||||
if (config["backend"] != undefined && config["backend"]["port"] != undefined) {
|
||||
configPort = config["backend"]["port"];
|
||||
}
|
||||
|
||||
var port = normalizePort(configPort || '3000');
|
||||
var port = normalizePort(configPort || '3001');
|
||||
app.set('port', port);
|
||||
console.log("Express server listening on port: " + port)
|
||||
|
||||
|
||||
@ -163,8 +163,8 @@ class DCSInstance {
|
||||
/* Read the olympus.json */
|
||||
var config = JSON.parse(fs.readFileSync(path.join(this.folder, "Config", "olympus.json")));
|
||||
this.frontendPort = config["frontend"]["port"];
|
||||
this.backendPort = config["server"]["port"];
|
||||
this.backendAddress = config["server"]["address"];
|
||||
this.backendPort = config["backend"]["port"];
|
||||
this.backendAddress = config["backend"]["address"];
|
||||
this.gameMasterPasswordHash = config["authentication"]["gameMasterPassword"];
|
||||
|
||||
this.gameMasterPasswordEdited = false;
|
||||
|
||||
@ -159,8 +159,8 @@ async function applyConfiguration(folder, instance) {
|
||||
|
||||
/* Apply the configuration */
|
||||
config["frontend"]["port"] = instance.frontendPort;
|
||||
config["server"]["port"] = instance.backendPort;
|
||||
config["server"]["address"] = instance.backendAddress;
|
||||
config["backend"]["port"] = instance.backendPort;
|
||||
config["backend"]["address"] = instance.backendAddress;
|
||||
config["authentication"]["gameMasterPassword"] = sha256(instance.gameMasterPassword);
|
||||
config["authentication"]["blueCommanderPassword"] = sha256(instance.blueCommanderPassword);
|
||||
config["authentication"]["redCommanderPassword"] = sha256(instance.redCommanderPassword);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"server": {
|
||||
"backend": {
|
||||
"address": "localhost",
|
||||
"port": 3001
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user