mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-24 16:23:12 +09:00
Merge pull request #219 from Hornwitser/dev-notice
Add development warning
This commit is contained in:
3 files changed
+64
-8
No files matched your search
@@ -16,6 +16,13 @@ Or clone latest stable branch that has name format `x.y.z`
|
|||||||
|
|
||||||
Discord for development/support/play: https://discord.gg/5XuDkje
|
Discord for development/support/play: https://discord.gg/5XuDkje
|
||||||
|
|
||||||
|
## Important notice
|
||||||
|
|
||||||
|
This is the development branch for factorioClusterio 2.0 which is currently undergoing heavy
|
||||||
|
restructuring and refactoring. Expect plugins and existing installations to frequenltly break when
|
||||||
|
using this branch. If you don't want to be an alpha tester for 2.0 please use the stable
|
||||||
|
[1.2.x branch](https://github.com/clusterio/factorioClusterio/tree/1.2.x).
|
||||||
|
|
||||||
### Ways to support me/the project:
|
### Ways to support me/the project:
|
||||||
|
|
||||||
* Contribute with code/documentation. Always nice to move the project forward
|
* Contribute with code/documentation. Always nice to move the project forward
|
||||||
|
|||||||
@@ -20,6 +20,13 @@ const stringUtils = require("lib/stringUtils.js");
|
|||||||
const configManager = require("lib/manager/configManager.js");
|
const configManager = require("lib/manager/configManager.js");
|
||||||
const hashFile = require('lib/hash').hashFile;
|
const hashFile = require('lib/hash').hashFile;
|
||||||
|
|
||||||
|
console.warn(`
|
||||||
|
+==========================================================+
|
||||||
|
I WARNING: This is the development branch for the 2.0 I
|
||||||
|
I version of clusterio. Expect things to break. I
|
||||||
|
+==========================================================+
|
||||||
|
`);
|
||||||
|
|
||||||
// argument parsing
|
// argument parsing
|
||||||
const args = require('minimist')(process.argv.slice(2));
|
const args = require('minimist')(process.argv.slice(2));
|
||||||
|
|
||||||
|
|||||||
@@ -857,6 +857,29 @@ async function getPlugins(){
|
|||||||
return plugins;
|
return plugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Errror class for known errors occuring during startup
|
||||||
|
class StartupError extends Error { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls listen on server capturing any errors that occurs
|
||||||
|
* binding to the port.
|
||||||
|
*/
|
||||||
|
function listen(server, ...args) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
function wrapError(err) {
|
||||||
|
reject(new StartupError(
|
||||||
|
`Server listening failed: ${err.message}`
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
server.once('error', wrapError);
|
||||||
|
server.listen(...args, () => {
|
||||||
|
server.off('error', wrapError);
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async function startServer() {
|
async function startServer() {
|
||||||
// Set the process title, shows up as the title of the CMD window on windows
|
// Set the process title, shows up as the title of the CMD window on windows
|
||||||
// and as the process name in ps/top on linux.
|
// and as the process name in ps/top on linux.
|
||||||
@@ -921,7 +944,7 @@ async function startServer() {
|
|||||||
// Only start listening for connections after all plugins have loaded
|
// Only start listening for connections after all plugins have loaded
|
||||||
if (httpPort) {
|
if (httpPort) {
|
||||||
let httpServer = require("http").Server(app);
|
let httpServer = require("http").Server(app);
|
||||||
httpServer.listen(httpPort);
|
await listen(httpServer, httpPort);
|
||||||
console.log("Listening for HTTP on port %s...", httpServer.address().port);
|
console.log("Listening for HTTP on port %s...", httpServer.address().port);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -932,15 +955,16 @@ async function startServer() {
|
|||||||
privateKey = await fs.readFile(config.sslPrivKey);
|
privateKey = await fs.readFile(config.sslPrivKey);
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`Error loading ssl certificate: ${err.message}`);
|
throw new StartupError(
|
||||||
await shutdown()
|
`Error loading ssl certificate: ${err.message}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let httpsServer = require("https").createServer({
|
let httpsServer = require("https").createServer({
|
||||||
key: privateKey,
|
key: privateKey,
|
||||||
cert: certificate
|
cert: certificate
|
||||||
}, app)
|
}, app)
|
||||||
httpsServer.listen(httpsPort);
|
await listen(httpsServer, httpsPort);
|
||||||
console.log("Listening for HTTPS on port %s...", httpsServer.address().port);
|
console.log("Listening for HTTPS on port %s...", httpsServer.address().port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -948,11 +972,29 @@ async function startServer() {
|
|||||||
module.exports = app;
|
module.exports = app;
|
||||||
|
|
||||||
if (module === require.main) {
|
if (module === require.main) {
|
||||||
|
console.warn(`
|
||||||
|
+==========================================================+
|
||||||
|
I WARNING: This is the development branch for the 2.0 I
|
||||||
|
I version of clusterio. Expect things to break. I
|
||||||
|
+==========================================================+
|
||||||
|
`
|
||||||
|
);
|
||||||
startServer().catch(err => {
|
startServer().catch(err => {
|
||||||
console.error(
|
if (!(err instanceof StartupError)) {
|
||||||
"Unexpected error occured while starting master, please report\n"+
|
console.error(`
|
||||||
"it to https://github.com/clusterio/factorioClusterio/issues"
|
+---------------------------------------------------------------+
|
||||||
);
|
| Unexpected error occured while starting master, please report |
|
||||||
|
| it to https://github.com/clusterio/factorioClusterio/issues |
|
||||||
|
+---------------------------------------------------------------+`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
console.error(`
|
||||||
|
+----------------------------------+
|
||||||
|
| Unable to to start master server |
|
||||||
|
+----------------------------------+`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
console.error(err);
|
console.error(err);
|
||||||
return shutdown();
|
return shutdown();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user