diff options
author | Eugene Sokolov <eug-vs@keemail.me> | 2020-06-27 00:19:17 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-27 00:19:17 +0300 |
commit | 08994137ddbeee5c3d407c215575e9681fd3962b (patch) | |
tree | 76eafd1739ca8e85882990ad8b8c50626ad450ce /populateDb.ts | |
parent | c4619eb6d3fb3b9df5d921250391bb49700f055d (diff) | |
parent | 1fbf5ffbabc1ea2924e68c735e4d2b87643b5fc0 (diff) | |
download | which-api-08994137ddbeee5c3d407c215575e9681fd3962b.tar.gz |
Merge pull request #13 from which-ecosystem/deployment
Setup project for Heroku deployment
Diffstat (limited to 'populateDb.ts')
-rw-r--r-- | populateDb.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/populateDb.ts b/populateDb.ts index e978403..b3e46af 100644 --- a/populateDb.ts +++ b/populateDb.ts @@ -5,7 +5,15 @@ import { User, Poll, Vote } from 'which-types'; import app from './app'; -mongoose.connect('mongodb://localhost:27017/which', { useNewUrlParser: true }); +const MONGODB_URL = process.env.MONGODB_URI || 'mongodb://localhost:27017/which'; + +mongoose.connect(MONGODB_URL, { + useNewUrlParser: true, + useUnifiedTopology: true, + useCreateIndex: true, + useFindAndModify: false, + family: 4 // Use IPv4, skip trying IPv6 +}); const POLLS_AMOUNT = 20; |