mirror of
https://github.com/informaticker/discord-jellyfin-bot.git
synced 2024-11-23 18:21:55 +01:00
17 lines
1.0 KiB
JavaScript
17 lines
1.0 KiB
JavaScript
const fs = require("fs");
|
|
const filename = "./config.json";
|
|
const configfile = require(filename);
|
|
|
|
if (process.env.DISCORD_PREFIX) { configfile["discord-prefix"] = process.env.DISCORD_PREFIX; }
|
|
if (process.env.DISCORD_TOKEN) { configfile.token = process.env.DISCORD_TOKEN; }
|
|
if (process.env.JELLYFIN_SERVER_ADDRESS) { configfile["server-address"] = process.env.JELLYFIN_SERVER_ADDRESS; }
|
|
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); }
|
|
if (process.env.LOG_LEVEL) { configfile["log-level"] = process.env.LOG_LEVEL; }
|
|
|
|
fs.writeFile(filename, JSON.stringify(configfile, null, 1), (err) => {
|
|
if (err) return console.error(err);
|
|
});
|