Skip to content

Commit

Permalink
removed infratoken requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
Adnan Rahic committed Dec 23, 2020
1 parent 220bda0 commit ad090ca
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions lib/agent.js
Expand Up @@ -24,23 +24,30 @@ const sematextAgentExpress = () => {
const logsToken = process.env.LOGS_TOKEN
const infraToken = process.env.INFRA_TOKEN

if (!(monitoringToken && infraToken) && !logsToken) {
console.log('Please add MONITORING_TOKEN, INFRA_TOKEN, and LOGS_TOKEN')
return {}
} else if (!(monitoringToken && infraToken) && logsToken) {
console.log('You have added a LOGS_TOKEN')
if (!monitoringToken && !logsToken) {
return {
stMonitor: { start: () => console.log('Please add a MONITORING_TOKEN and INFRA_TOKEN if you want to configure shipping metrics') },
stMonitor: { start: () => console.log('Please add a MONITORING_TOKEN and LOGS_TOKEN if you want to configure shipping metrics and logs') },
stLogger: () => console.log('Please add a MONITORING_TOKEN and LOGS_TOKEN if you want to configure shipping metrics and logs'),
stHttpLoggerMiddleware: () => console.log('Please add a MONITORING_TOKEN and LOGS_TOKEN if you want to configure shipping metrics and logs')
}
} else if (!monitoringToken && logsToken) {
return {
stMonitor: { start: () => console.log('Please add a MONITORING_TOKEN if you want to configure shipping metrics') },
stLogger: stLogger(),
stHttpLoggerMiddleware: stHttpLoggerMiddleware()
}
} else if ((monitoringToken && infraToken) && !logsToken) {
console.log('You have added a MONITORING_TOKEN and INFRA_TOKEN\nPlease add a LOGS_TOKEN if you want to configure shipping logs')
} else if (monitoringToken && !logsToken) {
return {
stMonitor: stMonitor()
stMonitor: stMonitor(),
stLogger: () => console.log('Please add a LOGS_TOKEN if you want to configure shipping logs'),
stHttpLoggerMiddleware: () => console.log('Please add a LOGS_TOKEN if you want to configure shipping logs')
}
}

if (!infraToken) {
console.log('Info (Not mandatory): To enable Process metrics, add an INFRA_TOKEN.')
}

return {
stMonitor: stMonitor(),
stLogger: stLogger(),
Expand Down

0 comments on commit ad090ca

Please sign in to comment.