Skip to content

Commit 6d6ba74

Browse files
author
Hans Kristian Flaatten
committed
fix(test): use env vars for db connection
1 parent 36bb210 commit 6d6ba74

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Diff for: test/support/mongo.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@ const Mongo = function Mongo(uri) {
2121

2222
inherits(Mongo, EventEmitter);
2323

24-
module.exports = new Mongo('mongodb://mongo:27017/test');
24+
const addr = process.env.MONGO_PORT_27017_TCP_ADDR || 'mongo';
25+
const port = process.env.MONGO_PORT_27017_TCP_PORT || '27017';
26+
const db = 'test';
27+
28+
module.exports = new Mongo(`mongodb://${addr}:${port}/${db}`);

Diff for: test/support/redis.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22

33
const Redis = require('ioredis');
44

5-
module.exports = new Redis(6379, 'redis');
5+
const addr = process.env.MONGO_PORT_27017_TCP_ADDR || 'redis';
6+
const port = process.env.MONGO_PORT_27017_TCP_PORT || '6379';
7+
8+
module.exports = new Redis(port, addr);

0 commit comments

Comments
 (0)