discord-jellyfin-bot/parseENV.js

17 lines
1.0 KiB
JavaScript
Raw Normal View History

2020-09-21 05:30:39 +02:00
const fs = require("fs");
const filename = "./config.json";
2020-09-08 14:02:00 +02:00
const configfile = require(filename);
2020-10-08 06:42:23 +02:00
if (process.env.DISCORD_PREFIX) { configfile["discord-prefix"] = process.env.DISCORD_PREFIX; }
if (process.env.DISCORD_TOKEN) { configfile.token = process.env.DISCORD_TOKEN; }
2021-10-15 14:04:29 +02:00
if (process.env.JELLYFIN_SERVER_ADDRESS) { configfile["server-address"] = process.env.JELLYFIN_SERVER_ADDRESS; }
2020-10-08 06:42:23 +02:00
if (process.env.JELLYFIN_USERNAME) { configfile["jellyfin-username"] = process.env.JELLYFIN_USERNAME; }
if (process.env.JELLYFIN_PASSWORD) { configfile["jellyfin-password"] = process.env.JELLYFIN_PASSWORD; }
if (process.env.JELLYFIN_APP_NAME) { configfile["jellyfin-app-name"] = process.env.JELLYFIN_APP_NAME; }
if (process.env.MESSAGE_UPDATE_INTERVAL) { configfile["interactive-seek-bar-update-intervall"] = parseInt(process.env.MESSAGE_UPDATE_INTERVAL); }
2021-01-18 06:49:32 +01:00
if (process.env.LOG_LEVEL) { configfile["log-level"] = process.env.LOG_LEVEL; }
2020-09-08 14:02:00 +02:00
2020-09-21 05:30:39 +02:00
fs.writeFile(filename, JSON.stringify(configfile, null, 1), (err) => {
2020-09-23 17:06:20 +02:00
if (err) return console.error(err);
2020-09-21 05:30:39 +02:00
});