Skip to content

Commit

Permalink
Fixed env support
Browse files Browse the repository at this point in the history
  • Loading branch information
Prince527GitHub committed Apr 28, 2024
1 parent 75a3d17 commit bfd5005
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
const { envString, envJSON } = require("./packages/env");
const env = require("dotenv");

try {
global.config = require("./config.json");
} catch (e) {
try {
env.config();
require("dotenv").config();
} catch (e) {}

global.config = envJSON(envString(process.env));
global.config = envJSON(envString());
}

if (!global.config) {
Expand Down
4 changes: 3 additions & 1 deletion packages/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ function envString() {
let envString = '';

for (let key in process.env) {
envString += `${key}=${process.env[key]}\n`;
if (key.startsWith("SERVER") || key.startsWith("MUSIC")) {
envString += `${key}=${process.env[key]}\n`;
}
}

return envString;
Expand Down

0 comments on commit bfd5005

Please sign in to comment.