Skip to content

Commit

Permalink
add backup folder config
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Feb 14, 2024
1 parent b72957d commit 8f377b4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions functions/saveDB.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@ const handleError = require("./handleError");
* @author Evorp, Juknum
* @param {import("discord.js").Client} client
* @param {string} commitMessage
* @param {{org?: string, repo?: string, branch?: string}} params configure where to backup to
* @param {{ org?: string, repo?: string, branch?: string, folder?: string }} params configure where to backup to
* @returns {Promise<{ successfulPushes: string[], failedPushes: string[], commit?: string }>}
*/
module.exports = async function saveDB(
client,
commitMessage = "Daily Backup",
{ org, repo, branch },
{ org, repo, branch, folder },
) {
const { backup } = require("@resources/settings.json");
org ||= backup.git.org;
repo ||= backup.git.repo;
branch ||= backup.git.branch;
folder ||= backup.git.folder;

const folderPath = join(process.cwd(), "backups", backup.git.folder);
const folderPath = join(process.cwd(), "backups", folder);
mkdirSync(folderPath, { recursive: true });

const successfulPushes = [];
Expand Down

0 comments on commit 8f377b4

Please sign in to comment.