Skip to content

Commit

Permalink
fix: udpate env vars from CM to include name, retries
Browse files Browse the repository at this point in the history
  • Loading branch information
karanwadhwa authored and sydrawat01 committed Nov 22, 2023
1 parent 4d108fb commit 5536c64
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
5 changes: 4 additions & 1 deletion config/app.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import 'dotenv/config'

const { BROKER_0, BROKER_1, BROKER_2, CLIENT_ID, TOPIC, URL } = process.env
const { BROKER_0, BROKER_1, BROKER_2, CLIENT_ID, TOPIC, URL, NAME, RETRIES } =
process.env
const producerConfig = {
BROKER_0,
BROKER_1,
BROKER_2,
CLIENT_ID,
TOPIC,
URL,
NAME,
RETRIES,
}

export default producerConfig
17 changes: 9 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { Kafka } from 'kafkajs'
import logger from './config/logger.config.js'
import producerConfig from './config/app.config.js'

const { BROKER_0, BROKER_1, BROKER_2, CLIENT_ID, TOPIC, URL } = producerConfig
const { BROKER_0, BROKER_1, BROKER_2, CLIENT_ID, TOPIC, URL, NAME, RETRIES } =
producerConfig
const topic = TOPIC
const brokers = [BROKER_0, BROKER_1, BROKER_2]

Expand All @@ -19,15 +20,15 @@ const init = async () => {
const response = await fetch(URL)
const status = await response.status
const data = {
name: 'google',
name: NAME,
uri: URL,
is_paused: true,
num_retries: 5,
uptime_sla: 100,
response_time_sla: 100,
use_ssl: true,
num_retries: RETRIES,
// is_paused: true,
// uptime_sla: 100,
// response_time_sla: 100,
// use_ssl: true,
response_status_code: status,
check_interval_in_seconds: 86400,
// check_interval_in_seconds: 86400,
}
const result = await producer.send({
topic,
Expand Down
7 changes: 6 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5536c64

Please sign in to comment.