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-09-21 05:30:39 +02:00
|
|
|
if (!configfile["discord-prefix"]) { configfile["discord-prefix"] = process.env.DISCORD_PREFIX; }
|
|
|
|
if (!configfile.token) { configfile.token = process.env.DISCORD_TOKEN; }
|
|
|
|
if (!configfile["server-adress"]) { configfile["server-adress"] = process.env.JELLYFIN_SERVER_ADDRESS; }
|
|
|
|
if (!configfile["jellyfin-username"]) { configfile["jellyfin-username"] = process.env.JELLYFIN_USERNAME; }
|
|
|
|
if (!configfile["jellyfin-password"]) { configfile["jellyfin-password"] = process.env.JELLYFIN_PASSWORD; }
|
|
|
|
if (!configfile["jellyfin-app-name"]) { configfile["jellyfin-app-name"] = process.env.JELLYFIN_APP_NAME; }
|
2020-09-30 17:27:09 +02:00
|
|
|
if (!configfile["interactive-seek-bar-update-intervall"]) { configfile["interactive-seek-bar-update-intervall"] = parseInt(process.env.MESSAGE_UPDATE_INTERVAL); }
|
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
|
|
|
});
|