Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
knowledge-mw-service
Commits
21888673
Unverified
Commit
21888673
authored
6 years ago
by
anoophm
Committed by
GitHub
6 years ago
Browse files
Options
Download
Patches
Plain Diff
Issue #SB-4786 fix: Default channel for telemetry
parent
a4ac3589
master
dependabot/npm_and_yarn/src/async-2.6.4
dependabot/npm_and_yarn/src/decode-uri-component-0.2.2
dependabot/npm_and_yarn/src/flat-and-mocha-5.0.2
dependabot/npm_and_yarn/src/handlebars-4.7.7
dependabot/npm_and_yarn/src/jsonwebtoken-9.0.0
dependabot/npm_and_yarn/src/lodash-4.17.21
dependabot/npm_and_yarn/src/minimist-and-project-sunbird/telemetry-sdk-and-handlebars-and-mkdirp-1.2.8
release-3.6.0
release-4.3.0
release-4.8.0
release-5.2.0
release-5.3.0
release-5.6.0
release-6.0.0
v1.13.3
v1.13
v1.12
v1.11.1
v1.11
v1.10.1
v1.10
v1.9
v1.8.2
v1.8
v1.7.1
tmp-testPR
tmp-sunbird-bootcamp
tmp-rjshrjndrn-patch-1
tmp-revert-118-testPR
tmp-revert-110-logs
tmp-revert-99-revert-98-revert-97-revert-96-rjshrjndrn-patch-1
tmp-revert-98-revert-97-revert-96-rjshrjndrn-patch-1
tmp-revert-97-revert-96-rjshrjndrn-patch-1
tmp-revert-96-rjshrjndrn-patch-1
tmp-release-sonarcloud
tmp-release-2.6.0
tmp-release-2.3.0
tmp-release-2.1.1
tmp-release-2.1.0
tmp-release-2.1.0_pluginSearch
tmp-release-2.0.0
tmp-release-1.15
tmp-release-1.14.3
tmp-release-1.14
tmp-release-1.14-sp3
tmp-release-1.8.3
tmp-refactored-dev-deploy
tmp-master
tmp-loadtest
tmp-load-testing
tmp-jenkins-test
tmp-jenkins-pipeline
tmp-final-variable-refac
tmp-dial-assemble-api
tmp-content-update-read
tmp-circleci
release-5.6.0_RC1
release-5.2.0_RC1
release-4.8.5_RC1
release-4.8.0_RC2
release-4.8.0_RC1
release-4.3.0_RC1
release-3.8.0_RC3
release-3.8.0_RC2
release-3.8.0_RC1
release-3.7.0_RC2
release-3.7.0_RC1
release-3.6.0_RC1
release-3.2.0_RC2
release-3.2.0_RC1
release-3.1.0
release-3.1.0_RC2
release-3.1.0_RC1
release-3.0.1_RC1
release-3.0.0
release-3.0.0_RC1
release-2.10.0
release-2.10.0_RC2
release-2.10.0_RC1
release-2.9.0_RC3
release-2.9.0_RC2
release-2.9.0_RC1
release-2.8.0
release-2.8.0_RC4
release-2.8.0_RC3
release-2.8.0_RC2
release-2.8.0_RC1
release-2.7.0
release-2.7.0_RC2
release-2.7.0_RC1
release-2.6.0
release-2.6.0_RC4
release-2.6.0_RC3
release-2.6.0_RC2
release-2.6.0_RC1
release-2.3.0
release-2.3.0_RC2
release-2.3.0_RC1
release-2.1.1_RC1
release-2.1.0_RC2
release-2.1.0_RC1
release-2.0.0
release-2.0.0_RC5
release-2.0.0_RC4
release-2.0.0_RC3
release-2.0.0_RC2
release-2.0.0_RC1
release-1.15.0
release-1.15_RC7
release-1.15_RC6
release-1.15_RC5
release-1.15_RC4
release-1.15_RC3
release-1.15_RC2
release-1.15_RC1
release-1.14.0
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app.js
+18
-11
src/app.js
with
18 additions
and
11 deletions
+18
-11
src/app.js
+
18
−
11
View file @
21888673
...
...
@@ -12,7 +12,7 @@ var _ = require('underscore')
var
filename
=
path
.
basename
(
__filename
)
var
utilsService
=
require
(
'
./service/utilsService
'
)
var
LOG
=
require
(
'
sb_logger_util
'
)
const
contentProvider
=
require
(
'
sb_content_provider_util
'
)
// TODO below configuration should to be refactored in a seperate file
const
contentProviderConfigPath
=
path
.
join
(
__dirname
,
'
/config/contentProviderApiConfig.json
'
)
...
...
@@ -22,14 +22,13 @@ const telemtryEventConfig = JSON.parse(fs.readFileSync(path.join(__dirname, 'con
var
reqDataLimitOfContentUpload
=
'
50mb
'
const
port
=
process
.
env
.
sunbird_content_service_port
?
process
.
env
.
sunbird_content_service_port
:
5000
const
DEFAULT_TENANT
=
process
.
env
.
sunbird_default_channel
globalEkstepProxyBaseUrl
=
process
.
env
.
sunbird_content_plugin_base_url
?
process
.
env
.
sunbird_content_plugin_base_url
:
'
https://qa.ekstep.in
'
const
contentProviderBaseUrl
=
process
.
env
.
sunbird_content_provider_api_base_url
?
process
.
env
.
sunbird_content_provider_api_base_url
:
'
https://qa.ekstep.in/api
'
const
contentProviderApiKey
=
process
.
env
.
sunbird_content_provider_api_key
const
telemetryBaseUrl
=
process
.
env
.
sunbird_telemetry_service_local_url
?
process
.
env
.
sunbird_telemetry_service_local_url
:
'
http://telemetry-service:9001/
'
const
learnerServiceApiKey
=
process
.
env
.
sunbird_learner_service_api_key
const
learnerServiceBaseUrl
=
process
.
env
.
sunbird_learner_service_base_url
?
process
.
env
.
sunbird_learner_service_base_url
:
'
https://dev.open-sunbird.org/api
'
...
...
@@ -44,7 +43,6 @@ const producerId = process.env.sunbird_environment + '.' + process.env.sunbird_i
configUtil
.
setContentProviderApi
(
contentProviderApiConfig
.
API
)
configUtil
.
setConfig
(
'
BASE_URL
'
,
contentProviderBaseUrl
)
configUtil
.
setConfig
(
'
TELEMETRY_BASE_URL
'
,
telemetryBaseUrl
)
configUtil
.
setConfig
(
'
Authorization_TOKEN
'
,
'
Bearer
'
+
contentProviderApiKey
)
configUtil
.
setConfig
(
'
LEARNER_SERVICE_BASE_URL
'
,
learnerServiceBaseUrl
)
configUtil
.
setConfig
(
'
LEARNER_SERVICE_LOCAL_BASE_URL
'
,
learnerServiceLocalBaseUrl
)
...
...
@@ -113,14 +111,23 @@ require('./routes/externalUrlMetaRoute')(app)
require
(
'
./middlewares/proxy.middleware
'
)(
app
)
// Create server
this
.
server
=
http
.
createServer
(
app
).
listen
(
port
,
function
()
{
console
.
log
(
'
server running at PORT [%d]
'
,
port
)
if
(
!
process
.
env
.
sunbird_environment
||
!
process
.
env
.
sunbird_instance
)
{
console
.
error
(
'
please set environment variable sunbird_environment, sunbird_instance
'
+
'
start service Eg: sunbird_environment = dev, sunbird_instance = sunbird
'
)
contentProvider
.
getChannel
(
process
.
env
.
sunbird_default_tenant
,
(
err
,
res
)
=>
{
if
(
res
.
result
.
response
.
count
>
0
&&
res
.
result
.
response
.
content
[
0
].
hashTagId
)
{
configUtil
.
setConfig
(
'
DEFAULT_CHANNEL
'
,
res
.
result
.
response
.
content
[
0
].
hashTagId
)
console
.
log
(
'
DEFAULT_CHANNEL
'
,
configUtil
.
getConfig
(
'
DEFAULT_CHANNEL
'
))
this
.
server
=
http
.
createServer
(
app
).
listen
(
port
,
function
()
{
console
.
log
(
'
server running at PORT [%d]
'
,
port
)
if
(
!
process
.
env
.
sunbird_environment
||
!
process
.
env
.
sunbird_instance
)
{
console
.
error
(
'
please set environment variable sunbird_environment, sunbird_instance, sunbird_default_tenant
'
+
'
start service Eg: sunbird_environment = dev, sunbird_instance = sunbird
'
)
process
.
exit
(
1
)
}
updateConfig
(
getFilterConfig
())
})
}
else
{
console
.
log
(
'
error in fetching default channel
'
,
err
,
res
)
process
.
exit
(
1
)
}
updateConfig
(
getFilterConfig
())
})
// Close server, when we start for test cases
...
...
@@ -145,7 +152,7 @@ const telemetryConfig = {
method
:
'
POST
'
,
batchsize
:
telemetryBatchSize
,
endpoint
:
configUtil
.
getConfig
(
'
TELEMETRY
'
),
host
:
configUtil
.
getConfig
(
'
TELEMETRY_
BASE_URL
'
),
host
:
configUtil
.
getConfig
(
'
BASE_URL
'
),
authtoken
:
configUtil
.
getConfig
(
'
Authorization_TOKEN
'
)
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets