From 260a1aa15af5d1953e5cbed261455546e1c295bb Mon Sep 17 00:00:00 2001 From: Robert A Dingwell Date: Mon, 1 May 2023 10:24:13 -0400 Subject: [PATCH] moving hardcoded values to env.json file --- env.json | 4 ++++ src/config.ts | 5 ++--- src/lib/MongoDatabase.ts | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/env.json b/env.json index b36b4dd9..f538e877 100644 --- a/env.json +++ b/env.json @@ -34,5 +34,9 @@ "VSAC_API_KEY": { "type": "string", "default": "changeMe" + }, + "SMART_ENDPOINT": { + "type": "string", + "default" : "http://localhost:3005/launch" } } diff --git a/src/config.ts b/src/config.ts index bd30a0c2..3f363d4e 100644 --- a/src/config.ts +++ b/src/config.ts @@ -9,14 +9,13 @@ const whitelist_env = // If it's length is 1, set it to a string, so * works // If there are multiple, keep them as an array const whitelist = whitelist_env && whitelist_env.length === 1 ? whitelist_env[0] : whitelist_env; - export default { server: { - port: 8090, + port: env.PORT || env.SERVER_PORT, discoveryEndpoint: '/cds-services' }, smart: { - endpoint: 'http://localhost:3005/launch' + endpoint: env.SMART_ENDPOINT }, logging: { level: 'info' diff --git a/src/lib/MongoDatabase.ts b/src/lib/MongoDatabase.ts index 27661738..448f58c1 100644 --- a/src/lib/MongoDatabase.ts +++ b/src/lib/MongoDatabase.ts @@ -16,7 +16,7 @@ export class MongoDatabase extends Database { new Promise(resolve => { // Connect to mongo console.log('MongoDatabase connect: ' + this.location); - const dbString = `${this.location}${this.db_name}`; + const dbString = `${this.location}/${this.db_name}`; this.client = new mongoose.mongo.MongoClient(dbString); this.database = this.client.db(this.db_name); return resolve(mongoose.connect(dbString));