mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 08:13:12 +09:00
Fixes for last commit
This commit is contained in:
1 parent
94bbf62c26
commit
ea8f819bd5
1 file changed
+6
-1
@@ -22,7 +22,7 @@ debug = false;
|
|||||||
|
|
||||||
// constants
|
// constants
|
||||||
const masterModFolder = "./database/masterMods/";
|
const masterModFolder = "./database/masterMods/";
|
||||||
var config = require('./config');
|
const config = require('./config');
|
||||||
|
|
||||||
// homebrew modules
|
// homebrew modules
|
||||||
const getFactorioLocale = require("./lib/getFactorioLocale");
|
const getFactorioLocale = require("./lib/getFactorioLocale");
|
||||||
@@ -56,6 +56,11 @@ function randomStringAsBase64Url(size) {
|
|||||||
if (!fs.existsSync("secret-api-token.txt")) {
|
if (!fs.existsSync("secret-api-token.txt")) {
|
||||||
config.masterAuthSecret = randomStringAsBase64Url(256);
|
config.masterAuthSecret = randomStringAsBase64Url(256);
|
||||||
fs.writeFileSync("config.json",JSON.stringify(config, null, 4));
|
fs.writeFileSync("config.json",JSON.stringify(config, null, 4));
|
||||||
|
fs.writeFileSync("secret-api-token.txt", jwt.sign({ id: "api" }, config.masterAuthSecret, {
|
||||||
|
expiresIn: 86400*365 // expires in 1 year
|
||||||
|
}));
|
||||||
|
console.log("Generated new master authentication private key!");
|
||||||
|
process.exit(0);
|
||||||
}
|
}
|
||||||
// write an auth token to file
|
// write an auth token to file
|
||||||
fs.writeFileSync("secret-api-token.txt", jwt.sign({ id: "api" }, config.masterAuthSecret, {
|
fs.writeFileSync("secret-api-token.txt", jwt.sign({ id: "api" }, config.masterAuthSecret, {
|
||||||
|
|||||||
Reference in new issue
Block a user