Skip to content

Commit

Permalink
fix(server):Add MONGO_URI from environment for docker deployment (#46)
Browse files Browse the repository at this point in the history
…Fixes #43

* Adding mongo uri from environment for docker deployment and external mongo db

* Update server/config/database.js

Committing suggestion

Co-Authored-By: KarimJedda <KarimJedda@users.noreply.github.com>
  • Loading branch information
KarimJedda authored and vivekratnavel committed Jan 26, 2019
1 parent 40a39a2 commit 3fc55f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ To connect with mongodb that runs in another docker container:
docker network create omniboard-network
# make sure that mongodb container is using the same docker network before running this command
docker run -it --rm -p 9000:9000 --name omniboard --net=omniboard-network vivekratnavel/omniboard -m MONGODB_CONTAINER:27017:sacred
# or use the MONGO_URI environment variable
docker run -it --rm -p 9000:9000 --name omniboard -e MONGO_URI=<mongo_uri> --net=omniboard-network vivekratnavel/omniboard
```

Go to http://localhost:9000 to access omniboard. To debug, use `docker logs <OMNIBOARD_CONTAINER>`
Expand Down
2 changes: 2 additions & 0 deletions server/config/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ if ('m' in argv) {
// Parse mongodb connection url passed as an arg
// Ex: --mu mongodb://user:pwd@host/sacred?authSource=admin
mongodbURI = `${argv['mu']}`;
} else if (process.env.MONGO_URI) {
mongodbURI = process.env.MONGO_URI;
} else {
mongodbURI = `${defaultURI}/${defaultDatabase}`;
}
Expand Down

0 comments on commit 3fc55f6

Please sign in to comment.