Loading...
'; echo ''; } ?>
Leave feedback 1/4
Please leave feedback here to help us make this site better; you can choose to be anonymous.
We look over the feedback to know how we can improve the site and get what users want.
 
Do you want to be anonymous when leaving feedback?
Check for Yes
Next
Leave feedback 2/4
What is your overall impression of the layout?
Terrible AWESOME!!!
 
How easy is it to navigate the site?
Extremely easy How do I get out of here?
Next
Leave feedback 3/4
What is your overall impression of the functionality?
You call that functionality? Excellent!
 
How easy was it to understand what the site is about?
I still have no clue. I knew it before I came here!
Next
Leave feedback 4/4
Leave comments or suggestions here.
Send
Something went wrong; please check that you have marked all questions.
Start Forum Posts Leaderboard More















Mutation

Logged Out
Leaderboard coming soon

Engineering Solutions for the Church

Christian Engineering Solutions (CES) is a Not for Profit Organization specializing in collaborative solutions development for the Church. In the Spirit of Jesus Christ, we are to spread the gospel throughout the Earth, taking care to be good examples of Christ Jesus by serving others. CES is designed to help the Church meet these goals in the most rigorous manner possible.

Our Technology

Our Technology is scripture based in its goals and foundations. Open-Source and Free, one may use our services to both learn and solve problems with the goals of helping others and growing closer to God.

Features

Merit-based Reputation and Rewards

Streamlined Search and Citations

Modular Applications

Peer-to-Peer and Encryption Technologies (Under Development)

External Repository

https://github.com/ChristianEngineeringSolutions/ChristianEngineeringSolutions


Setup Account with email to earn rewards from reputation and donations.
Projects/Source Code
backup/

ADMIN
One Way , 8/8/2024
   Project in Projects/Source Code
0 Stars  
ADMIN
One Way , 8/8/2024
   Project in Projects/Source Code/backup/
var backup = require('mongodb-backup');
var encryptor = require('file-encryptor');
var fs = require('fs');
const { exec } = require('child_process');
const nodemailer = require('nodemailer');
require('dotenv').config({path: __dirname + '/../.env'})

exec('rm -rf sasame sasame.zip');
 
backup({
  uri: process.env.MONGODB_CONNECTION_URL,
  root: __dirname,
  callback: function(){

	var key = process.env.ENCRYPTION_KEY;

	var filesProcessed = 0;
	var numFiles = 0;

	// Encrypt files
	//within this dir is a dir for each collection
	var dir = 'sasame/';
    fs.readdir(dir, (err, dirs) => {
      dirs.forEach(function(sub_dir){
      	fs.readdir((dir + sub_dir), (err, files) => {
      		numFiles += files.length;
      		files.forEach(file => {
      			//encrypt into .dat
      			encryptor.encryptFile((dir + sub_dir + '/' + file), (dir + sub_dir + '/' + file.split('.')[0]+'.dat'), key, function(err) {
					//delete original
					fs.unlink(dir + sub_dir + '/' + file);
					++filesProcessed;
					//run on last iteration
					if(filesProcessed == numFiles){
						//now we need to zip sasame/
						var folderLocation =  'sasame';
						var zipLocation =  'sasame.zip';
						exec('zip -r '+zipLocation+' '+folderLocation, (error, stdout, stderr) => {
							//now delete unzipped folder
							exec('rm -rf ' + folderLocation);
							//now email the zipped file
							sendEmail('uriahsanders99@gmail.com', 'Sasame Backup', 'Attached.', __dirname + '/' + zipLocation);
							console.log('Backup Complete.');
						});
					}
				});
      		});
      	});
      });
    });
  }
});

function sendEmail(to, subject, body, file){
    var transporter = nodemailer.createTransport({
      service: 'gmail',
      auth: {
        user: process.env.EMAIL_USERNAME,
        pass: process.env.EMAIL_PASSWORD
      }
    });

    var mailOptions = {
      from: process.env.EMAIL_USERNAME,
      to: to,
      subject: subject,
      text: body,
      attachments: [
      	{
      		path: file
      	}
      ]
    };

    transporter.sendMail(mailOptions, function(error, info){
      if (error) {
        console.log(error);
      } else {
        console.log('Email sent: ' + info.response);
      }
    });
}

0 Stars  
ADMIN
One Way , 8/8/2024
   Project in Projects/Source Code/backup/
//okay we first need to get all json files from the server
//then we need to download everything from uploads
 
var dbUri = "mongodb://127.0.0.1:27017/sasame";
 
//example dbUri with username and password for the database test
// var dbUri = "mongodb://username:pwd@127.0.0.1:27017/test";
 
 
var basePath = "./backup";
var Backup = require("backup-mongodb");
 
new Backup(dbUri, basePath).backup();

0 Stars  
ADMIN
One Way , 8/8/2024
   Project in Projects/Source Code/backup/
var restore = require('mongodb-restore');
var encryptor = require('file-encryptor');
var fs = require('fs');
const { exec } = require('child_process');
require('dotenv').config({path: __dirname + '/../.env'})
var key = process.env.ENCRYPTION_KEY;
var numFiles = 0;
var filesProcessed = 0;

//first unzip
exec('unzip sasame.zip', (err, stdout, stderr) => {
	// Decrypt files
	//within this dir is a dir for each collection
	var dir = 'sasame/';
	fs.readdir(dir, (err, dirs) => {
	  dirs.forEach(function(sub_dir){
	  	fs.readdir((dir + sub_dir), (err, files) => {
	  		numFiles += files.length;
	  		files.forEach(file => {
	  			encryptor.decryptFile((dir + sub_dir + '/' + file), (dir + sub_dir + '/' + file.split('.')[0]+'.bson'), key, function(err) {
				  // Decryption complete.
				  console.log('Decrypted ' + file);
				  //delete original
				  fs.unlink(dir + sub_dir + '/' + file);
				});
				++filesProcessed;
				//run on last iteration
				if(filesProcessed == numFiles){
					restore({
					  uri: process.env.MONGODB_CONNECTION_URL,
					  root: __dirname + '/sasame',
					  drop: true,
					  callback: function(){
					  	console.log('Database Restored.');
					  	//now backup the data again so it is always encrypted
					  	//this also cleans the dir
					  	exec('node backup.js');
					  }
					});
				}
	  		});
	  	});
	  });
	});
});

0 Stars