Remove config file for client, moved to .env

This commit is contained in:
Logan Cusano
2023-05-07 04:40:46 -04:00
parent e0b6e567c1
commit ed79403a9b
6 changed files with 54 additions and 45 deletions

View File

@@ -6,12 +6,12 @@ const replace = require('replace-in-file');
class Options {
constructor(key, updatedValue) {
this.files = "./config/clientConfig.js";
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 (typeof updatedValue === "string") this.to = `"${key}": "${updatedValue}",`;
else this.to = `"${key}": ${updatedValue},`;
if (Array(["string", "number"]).includes(typeof updatedValue)) this.to = `${key}="${updatedValue}",`;
else this.to = `${key}=${updatedValue},`;
}
}