Skip to content

Commit 9dabba3

Browse files
authored
chore(heroku): support heroku mongodb url (snyk-labs#720)
1 parent aab037b commit 9dabba3

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

app.json

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
{
22
"name": "goof",
3-
"scripts": {
4-
},
3+
"description": "A Snyk vulnerable Goof app on Heroku",
4+
"repository": "https://github.com/snyk/goof",
5+
"logo": "https://snyk.io/wp-content/uploads/title-card-avatar.png",
6+
"keywords": [
7+
"snyk",
8+
"goof",
9+
"heroku",
10+
"node",
11+
"security",
12+
"vulnerabilities"
13+
],
14+
"image": "heroku/nodejs",
15+
"scripts": {},
516
"env": {
617
"MONGOLAB_URI": {
718
"required": true
@@ -20,4 +31,4 @@
2031
"url": "heroku/nodejs"
2132
}
2233
]
23-
}
34+
}

db.js

+4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ if (mongoCFUri) {
3535
} else if (process.env.MONGOLAB_URI) {
3636
// Generic (plus Heroku) env var support
3737
mongoUri = process.env.MONGOLAB_URI;
38+
} else if (process.env.MONGODB_URI) {
39+
// Generic (plus Heroku) env var support
40+
mongoUri = process.env.MONGODB_URI;
3841
}
42+
3943
console.log("Using Mongo URI " + mongoUri);
4044

4145
mongoose.connect(mongoUri);

0 commit comments

Comments
 (0)