Skip to content

Commit

Permalink
Added env to start multiple bots on start server "BOTS_TO_START"
Browse files Browse the repository at this point in the history
  • Loading branch information
sefirosweb committed Apr 4, 2024
1 parent 64c0253 commit 5316cfb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 28 deletions.
3 changes: 2 additions & 1 deletion core/.env_example
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ WEB_SERVER_PASSWORD=admin
DEBUG_MODE=false
CUSTOM_START=false
AUTO_RESTART=false
ENVIRONMENT=stage
ENVIRONMENT=stage
BOTS_TO_START=Miner2,Miner3
1 change: 1 addition & 0 deletions core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const webServerPassword = process.env.WEB_SERVER_PASSWORD
export const debugMode = process.env.DEBUG_MODE && process.env.DEBUG_MODE === "true" ? true : false
export const customStart = process.env.CUSTOM_START && process.env.CUSTOM_START === "true" ? true : false
export const autoRestart = process.env.AUTO_RESTART && process.env.AUTO_RESTART === "true" ? true : false
export const botsToStart = process.env.BOTS_TO_START

const config: ConfigEnviorementVariables = {
environment,
Expand Down
36 changes: 9 additions & 27 deletions core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,19 @@
import { botType } from "base-types";
import { startBot } from "@/startBot";
import { connectCore } from "@/modules/connectSocket";
import { botsToStart as botsToStartEnv } from "@/config";

const index = () => {
connectCore()

const botsToStart: botType[] = [
// { username: 'MinerTest' },
// { username: 'MinerTestB' },
// { username: 'Type' },

// { username: "MinerY1" },
// { username: "MinerY2" },
// { username: "MinerY3" },
// { username: "MinerY4" },
// { username: "MinerY5" },
// { username: "MinerY6" },
// { username: "MinerY7" },
// { username: "MinerY8" },
const botsToStart: botType[] = [];

// { username: "MinerX+" },
// { username: "MinerX-" },
// { username: "MinerZ+" },
// { username: "MinerZ-" },
// { username: 'Breeder' },
// { username: 'Guard1' },
// { username: 'Guard2' },
// { username: 'Guard3' },
// { username: 'Guard1' },
// { username: 'Guard2' },
// { username: 'Guard3' },
];
if (botsToStartEnv) {
const botsToStartEnvArray = botsToStartEnv.split(',');
botsToStartEnvArray.forEach((bot) => {
botsToStart.push({ username: bot });
});
}

let i = 0;
function runNextBot() {
Expand All @@ -44,8 +28,6 @@ const index = () => {
}

runNextBot();

connectCore()
};


Expand Down

0 comments on commit 5316cfb

Please sign in to comment.