Update client startup for new nodes
- Still needs to get IP from linux nodes - Other tasks still, idk
This commit is contained in:
@@ -8,10 +8,10 @@ class Options {
|
||||
constructor(key, updatedValue) {
|
||||
this.files = "./.env";
|
||||
// A regex of the line containing the key in the config file
|
||||
this.from = new RegExp(`${key}="(.+)",`, "g");
|
||||
this.from = new RegExp(`${key}="?(.+)"?`, "g");
|
||||
// Check to see if the value is a string and needs to be wrapped in double quotes
|
||||
if (Array(["string", "number"]).includes(typeof updatedValue)) this.to = `${key}="${updatedValue}",`;
|
||||
else this.to = `${key}=${updatedValue},`;
|
||||
else this.to = `${key}=${updatedValue}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class Options {
|
||||
* @param updatedId The updated ID assigned to the bot
|
||||
*/
|
||||
exports.updateId = (updatedId) => {
|
||||
this.updateConfig('id', updatedId);
|
||||
this.updateConfig('CLIENT_ID', updatedId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@ exports.updateConfig = function updateConfig(key, value) {
|
||||
function updateConfigFile(options, callback){
|
||||
replace(options, (error, changedFiles) => {
|
||||
if (error) return console.error('Error occurred:', error);
|
||||
log.DEBUG('Modified files:', changedFiles);
|
||||
log.VERBOSE('Modified files:', changedFiles);
|
||||
callback(changedFiles);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user