Skip to content

Commit

Permalink
Introduce MongoDB (major upgrade)
Browse files Browse the repository at this point in the history
  • Loading branch information
gideontong committed Dec 15, 2020
1 parent 2aa202c commit 388ebe3
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 15 deletions.
4 changes: 2 additions & 2 deletions SECURITY.md
Expand Up @@ -6,9 +6,9 @@ The following table shows which versions still recieve security updates. As alwa

| Version | Supported |
| ------- | ------------------ |
| 3.2.x | :white_check_mark: |
| 3.1.x | :white_check_mark: |
| 3.0.x | :white_check_mark: |
| < 3.0 | :x: |
| < 3.1 | :x: |

As 1.3.x is considered end of life, it will no longer recieve feature or security updates.

Expand Down
8 changes: 7 additions & 1 deletion config/secrets-blank.json
@@ -1,5 +1,11 @@
{
"amy": "YOUR_DISCORD_API_KEY_HERE",
"kevin": "YOUR_DISCORD_API_KEY_HERE",
"stocks": "YOUR_ALPHA_VANTAGE_API_KEY_HERE"
"stocks": "YOUR_ALPHA_VANTAGE_API_KEY_HERE",
"mongodb": {
"username": "YOUR_MONGODB_USERNAME_HERE",
"password": "YOUR_MONGODB_PASSWORD_HERE",
"domain": "YOUR_MONGODB_DOMAIN_HERE",
"database": "YOUR_MONGODB_DATABASE_HERE"
}
}
6 changes: 3 additions & 3 deletions docs/SECURITY.md
Expand Up @@ -15,9 +15,9 @@ The following table shows which versions still recieve security updates. As alwa

| Version | Supported |
| ------- | ------------------ |
| 2.0.x | :white_check_mark: |
| 1.3.x | :white_check_mark: |
| < 1.2 | :x: |
| 3.2.x | :white_check_mark: |
| 3.1.x | :white_check_mark: |
| < 3.1 | :x: |

As 1.3.x is considered end of life, it will no longer recieve feature updates. However, additional security patches will be added as they are reported.

Expand Down
11 changes: 10 additions & 1 deletion index.js
@@ -1,10 +1,11 @@
// Local imports
const { amy } = require('./config/secrets.json');
const { amy, mongodb } = require('./config/secrets.json');
const { prefix, activities } = require('./config/config.json');
const { generateLogName } = require('./lib/MagicNumbers');

// Dependency imports
const Discord = require('discord.js');
const Mongo = require('mongodb').MongoClient;
const log4js = require('log4js');
const client = new Discord.Client();

Expand All @@ -28,6 +29,14 @@ log4js.configure({
});
const log = log4js.getLogger('amy');

const dbURI = `mongodb+srv://${mongodb.username}:${mongodb.password}@${mongodb.domain}/${mongodb.database}?retryWrties=true&w=majority`;
const database = new Mongo(uri, { useNewUrlParser: true });
database.connect(err => {
const collection = database.db('test').collection('devices');
// perform actions on the collection object
database.close();
});

// Client setup
require('./event.js')(client);
require('./kevin/index.js');
Expand Down
79 changes: 73 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "amy",
"version": "3.1.22",
"version": "3.2.0",
"description": "Your personal assisstant, reimagined",
"author": "Gideon Tong <gideon@gideontong.com>",
"main": "index.js",
Expand All @@ -25,7 +25,7 @@
"canvas": "^2.6.1",
"discord.js": "^12.5.0",
"log4js": "^6.3.0",
"node-persist": "^3.1.0",
"mongodb": "^3.6.3",
"qrcode": "^1.4.4",
"youtube-dl": "^3.0.2"
},
Expand Down

0 comments on commit 388ebe3

Please sign in to comment.