-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
60 lines (51 loc) · 1.49 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//initializing dependencies
const { app, BrowserWindow, Menu } = require("electron");
var firebase = require("firebase");
const Nexmo = require("nexmo");
const nodemailer = require("nodemailer");
require("dotenv").config();
//main window... basically only window
var win;
//not required by application
Menu.setApplicationMenu(false);
function createWindow() {
let win = new BrowserWindow({
width: 720,
height: 500,
webPreferences: { nodeIntegration: true } //to make requirejs work
});
win.loadFile("app.html"); //main page
}
app.on("ready", createWindow);
//from env
var firebaseConfig = {
apiKey: process.env.FBKEY,
authDomain: process.env.AUTHDOMAIN,
databaseURL: process.env.DATABASEURL,
projectId: process.env.PROJECTID,
storageBucket: process.env.STORAGEBUCKET,
messagingSenderId: process.env.MESSAGINGSENDERID,
appId: process.env.APPID
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
//Initialize Nexmo, from env
const nexmo = new Nexmo({
apiKey: process.env.NXKEY,
apiSecret: process.env.NXSECRET
});
//Initialize NodeMailer,from env
let transport = nodemailer.createTransport({
service: "gmail",
host: "smtp.gmail.com",
port: 465,
secure: true,
auth: {
user: process.env.EMAIL,
pass: process.env.PASS
}
});
//Adding them to global varibles, for single initialisation and verification
global.nexi = nexmo.message; //adding direct message object, 'cuz nexmo is not further required.
global.firey = firebase;
global.mailer = transport;