diff --git a/bundle/.gitignore b/bundle/.gitignore
index 7d2cb508..cf073d9c 100644
--- a/bundle/.gitignore
+++ b/bundle/.gitignore
@@ -1 +1,2 @@
-files/
\ No newline at end of file
+files/
+.env
\ No newline at end of file
diff --git a/bundle/package-lock.json b/bundle/package-lock.json
index 14c54874..53bfdf1c 100644
--- a/bundle/package-lock.json
+++ b/bundle/package-lock.json
@@ -15,6 +15,7 @@
"@fosscord/gateway": "file:../gateway",
"@fosscord/util": "file:../util",
"async-exit-hook": "^2.0.1",
+ "dotenv": "^10.0.0",
"express": "^4.17.1",
"missing-native-js-functions": "^1.2.15",
"nanocolors": "^0.2.12",
@@ -864,6 +865,14 @@
"node": ">=0.3.1"
}
},
+ "node_modules/dotenv": {
+ "version": "10.0.0",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz",
+ "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==",
+ "engines": {
+ "node": ">=10"
+ }
+ },
"node_modules/ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
@@ -2350,6 +2359,11 @@
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
"dev": true
},
+ "dotenv": {
+ "version": "10.0.0",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz",
+ "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q=="
+ },
"ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
diff --git a/bundle/package.json b/bundle/package.json
index 2bcab8f6..5124fcdf 100644
--- a/bundle/package.json
+++ b/bundle/package.json
@@ -54,6 +54,7 @@
"@fosscord/gateway": "file:../gateway",
"@fosscord/util": "file:../util",
"async-exit-hook": "^2.0.1",
+ "dotenv": "^10.0.0",
"express": "^4.17.1",
"missing-native-js-functions": "^1.2.15",
"nanocolors": "^0.2.12",
diff --git a/bundle/src/start.ts b/bundle/src/start.ts
index d0686c13..353ebfc6 100644
--- a/bundle/src/start.ts
+++ b/bundle/src/start.ts
@@ -3,6 +3,8 @@ import cluster from "cluster";
import os from "os";
import { red, bold, yellow, cyan } from "nanocolors";
import { initStats } from "./stats";
+import { config } from "dotenv";
+config();
import { execSync } from "child_process";
// TODO: add tcp socket event transmission
@@ -10,15 +12,15 @@ const cores = 1 || Number(process.env.threads) || os.cpus().length;
export function getCommitOrFail() {
try {
- return execSync('git rev-parse HEAD').toString().trim();
- } catch(e) {
- return null
+ return execSync("git rev-parse HEAD").toString().trim();
+ } catch (e) {
+ return null;
}
}
-const commit = getCommitOrFail()
+const commit = getCommitOrFail();
-
-console.log(bold(`
+console.log(
+ bold(`
███████ ██████ ███████ ███████ ██████ ██████ ██████ ██████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
█████ ██ ██ ███████ ███████ ██ ██ ██ ██████ ██ ██
@@ -26,12 +28,24 @@ console.log(bold(`
██ ██████ ███████ ███████ ██████ ██████ ██ ██ ██████
- fosscord-server | ${yellow(`Pre-relase (${commit !== null ? commit.slice(0, 7) : "Unknown (Git cannot be found)"})`)}
+ fosscord-server | ${yellow(
+ `Pre-relase (${
+ commit !== null
+ ? commit.slice(0, 7)
+ : "Unknown (Git cannot be found)"
+ })`
+ )}
-Current commit: ${commit !== null ? `${cyan(commit)} (${yellow(commit.slice(0, 7))})` : "Unknown (Git cannot be found)" }
-`))
+Current commit: ${
+ commit !== null
+ ? `${cyan(commit)} (${yellow(commit.slice(0, 7))})`
+ : "Unknown (Git cannot be found)"
+ }
+`)
+);
-if(commit == null) console.log(yellow(`Warning: Git is not installed or not in PATH.`))
+if (commit == null)
+ console.log(yellow(`Warning: Git is not installed or not in PATH.`));
if (cluster.isMaster && !process.env.masterStarted) {
process.env.masterStarted = "true";
@@ -51,7 +65,9 @@ if (cluster.isMaster && !process.env.masterStarted) {
cluster.on("exit", (worker: any, code: any, signal: any) => {
console.log(
- `[Worker] ${red(`died with pid: ${worker.process.pid} , restarting ...`)}`
+ `[Worker] ${red(
+ `died with pid: ${worker.process.pid} , restarting ...`
+ )}`
);
cluster.fork();
});
diff --git a/bundle/src/stats.ts b/bundle/src/stats.ts
index e6941db2..d5ceeff7 100644
--- a/bundle/src/stats.ts
+++ b/bundle/src/stats.ts
@@ -5,7 +5,6 @@ export function initStats() {
console.log(`[Path] running in ${__dirname}`);
console.log(`[CPU] ${osu.cpu.model()} Cores x${osu.cpu.count()}`);
console.log(`[System] ${os.platform()} ${os.arch()}`);
- console.log(`[Database] started`);
console.log(`[Process] running with pid: ${process.pid}`);
setInterval(async () => {
|