From d0cd640032500164dbbfcec0aafee1be1eb678df Mon Sep 17 00:00:00 2001 From: Benedict Lee Date: Tue, 16 Apr 2024 23:45:07 +0800 Subject: [PATCH] Update MongoDB URI --- tests/graphql/project-template/08-queries.spec.js | 9 ++++++++- tests/graphql/project-template/09-mutations.spec.js | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/graphql/project-template/08-queries.spec.js b/tests/graphql/project-template/08-queries.spec.js index 8a549d9..f3fcea5 100644 --- a/tests/graphql/project-template/08-queries.spec.js +++ b/tests/graphql/project-template/08-queries.spec.js @@ -6,7 +6,14 @@ import axios from 'axios'; const ENDPOINT = "http://127.0.0.1:3000/api/graphql" -let uri = "mongodb://mongodb:t1oj5L_xQI8dTrVuZ@127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.1"; +let environment = process.env.ENVIRONMENT_URL + +let uri = "" + +if(environment == "https://127.0.0.1") + uri = "mongodb://mongodb:t1oj5L_xQI8dTrVuZ@127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.1"; +else if(environment == "https://host.docker.internal") + uri = "mongodb://mongodb:mongodb@127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.1"; const mongoClient = new MongoClient(uri) const database = mongoClient.db('aiverify') diff --git a/tests/graphql/project-template/09-mutations.spec.js b/tests/graphql/project-template/09-mutations.spec.js index a647ea3..bf20d95 100644 --- a/tests/graphql/project-template/09-mutations.spec.js +++ b/tests/graphql/project-template/09-mutations.spec.js @@ -6,7 +6,14 @@ import axios from 'axios'; const ENDPOINT = "http://127.0.0.1:3000/api/graphql" -let uri = "mongodb://mongodb:t1oj5L_xQI8dTrVuZ@127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.1"; +let environment = process.env.ENVIRONMENT_URL + +let uri = "" + +if(environment == "https://127.0.0.1") + uri = "mongodb://mongodb:t1oj5L_xQI8dTrVuZ@127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.1"; +else if(environment == "https://host.docker.internal") + uri = "mongodb://mongodb:mongodb@127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.1"; const mongoClient = new MongoClient(uri) const database = mongoClient.db('aiverify')