From 6ebefbf158de3f8ae7c0bfcd000c89a4baf9c317 Mon Sep 17 00:00:00 2001
From: Sourav Dey <sourav_d@techjoomla.com>
Date: Mon, 3 Dec 2018 12:06:26 +0530
Subject: [PATCH] Issue #SB-9180 feat: adding content service base url

---
 src/app.js                 | 2 ++
 src/service/lockService.js | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/app.js b/src/app.js
index 663b407..a169f14 100644
--- a/src/app.js
+++ b/src/app.js
@@ -48,6 +48,7 @@ const languageServiceApiKey = process.env.sunbird_language_service_api_key
 const producerId = process.env.sunbird_environment + '.' + process.env.sunbird_instance + '.content-service'
 const sunbirdPortalBaseUrl = process.env.sunbird_portal_base_url || 'https://staging.open-sunbird.org'
 const lockExpiryTime = process.env.sunbird_lock_expiry_time || 1800
+const contentServiceLocalBaseUrl = process.env.sunbird_content_service_local_base_url ? process.env.sunbird_content_service_local_base_url : 'http://content_service_content_service:5000'
 
 configUtil.setContentProviderApi(contentProviderApiConfig.API)
 configUtil.setConfig('CONTENT_REPO_BASE_URL', contentRepoBaseUrl)
@@ -69,6 +70,7 @@ configUtil.setConfig('LANGUAGE_SERVICE_BASE_URL', languageServiceBaseUrl)
 configUtil.setConfig('LANGUAGE_SERVICE_AUTHORIZATION_TOKEN', 'Bearer ' + languageServiceApiKey)
 configUtil.setConfig('SUNBIRD_PORTAL_BASE_URL', sunbirdPortalBaseUrl)
 configUtil.setConfig('LOCK_EXPIRY_TIME', lockExpiryTime)
+configUtil.setConfig('CONTENT_SERVICE_LOCAL_BASE_URL', contentServiceLocalBaseUrl)
 
 process.env.sunbird_cassandra_urls = process.env.sunbird_cassandra_urls || '127.0.0.1'
 process.env.dial_code_image_temp_folder = 'temp'
diff --git a/src/service/lockService.js b/src/service/lockService.js
index 8806139..245a45b 100644
--- a/src/service/lockService.js
+++ b/src/service/lockService.js
@@ -388,7 +388,7 @@ function checkResourceTypeValidation (req, CBW) {
   switch (lodash.lowerCase(req.body.request.resourceType)) {
   case 'content':
     var httpOptions = {
-      url: configUtil.getConfig('SUNBIRD_PORTAL_BASE_URL') + '/api/v1/content/getContentLockValidation',
+      url: configUtil.getConfig('CONTENT_SERVICE_LOCAL_BASE_URL') + '/v1/content/getContentLockValidation',
       headers: req.headers,
       method: 'POST',
       body: req.body,
-- 
GitLab