From d81653d944c7c9970cb4a71d1a3b9a7c9ca262ae Mon Sep 17 00:00:00 2001 From: Lamp Date: Fri, 13 Jul 2018 20:45:51 -0700 Subject: [PATCH] rm index.js --- .gitignore | 1 + Procfile | 2 +- index.js | 10 ---------- src/main.js | 13 +++++++++---- 4 files changed, 11 insertions(+), 15 deletions(-) delete mode 100644 index.js diff --git a/.gitignore b/.gitignore index 098d12e..35c0657 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules/ .DS_Store test.sh +.vscode diff --git a/Procfile b/Procfile index f2d1f0b..9f8263b 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -worker: node index.js +worker: node src/main.js diff --git a/index.js b/index.js deleted file mode 100644 index 9af36e1..0000000 --- a/index.js +++ /dev/null @@ -1,10 +0,0 @@ -(async function(){ - global.dbClient = new (require('pg').Client)({ - connectionString: process.env.DATABASE_URL, - ssl: true, - }); - await dbClient.connect(); - - require('./src/main'); - -})().catch(error => {console.error(error.stack); process.exit(1);}); \ No newline at end of file diff --git a/src/main.js b/src/main.js index 2ebb883..8636405 100755 --- a/src/main.js +++ b/src/main.js @@ -6,10 +6,15 @@ global.Discord = require('discord.js'); global.fs = require('fs'); global.dClient = new Discord.Client({ disableEveryone: true }); - -(require('mongodb').MongoClient).connect(config.MONGODB_URI).then(client=>{ - global.mdbClient = client; - dClient.login(config.DISCORD_TOKEN); +global.dbClient = new (require('pg').Client)({ + connectionString: process.env.DATABASE_URL, + ssl: !config.testmode, +}); +dbClient.connect().then(function(){ + (require('mongodb').MongoClient).connect(config.MONGODB_URI).then(client=>{ + global.mdbClient = client; + dClient.login(config.DISCORD_TOKEN); + }); }); dClient.once('ready', () => {