This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Make token | |
* @param {number} length Token length | |
* @param {number} expires_in Token expiration in seconds, default: 5 secs | |
* | |
* @return {Array} | |
*/ | |
const makeToken = (length, expires_in = 5) => { | |
let token = ''; | |
const characters = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global.CronJob = require('./cron.js'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const CronJob = require('cron').CronJob; | |
const Cron = require('./backup.js'); | |
// AutoBackUp every week (at 00:00 on Sunday) | |
new CronJob( | |
'0 0 * * 0', | |
function() { | |
Cron.dbAutoBackUp(); | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const _ = require('lodash'); | |
const exec = require('child_process').exec; | |
const path = require('path'); | |
// Concatenate root directory path with our backup folder. | |
const backupDirPath = path.join(__dirname, 'database-backup'); | |
const dbOptions = { | |
user: '<databaseUsername>', |