Tuesday, 3 December 2019

Question about testing Nodejs with Docker

Hello all,When I run locally my tests on my machine I use localhost as the URI to connect to my local MongoDB. On the other hand, I have made a docker-compose for testing on Gitlab and I need to use the container´s name rather than "localhost" (see https://stackoverflow.com/questions/44938344/cannot-connect-to-mongodb-via-node-js-in-docker)How would be the cleanest/most common way to check if I am running within Docker or not and use one URI or the other?I would like to have the ability to run test on my machine as well as in the Docker.Thank you in advance and regards.

Submitted December 03, 2019 at 08:35PM by dejavits

No comments:

Post a Comment