diff --git a/helm-chart/public/oneuptime/templates/_helpers.tpl b/helm-chart/public/oneuptime/templates/_helpers.tpl index c2ece40564..f4b43ad528 100644 --- a/helm-chart/public/oneuptime/templates/_helpers.tpl +++ b/helm-chart/public/oneuptime/templates/_helpers.tpl @@ -27,7 +27,7 @@ Expand the name of the chart. {{ printf "http://%s-backend.%s.%s" $.Release.Name $.Release.Namespace "svc.cluster.local" }} {{- end -}} -{{- define "oneuptime.fetchResourcesUrl" -}} +{{- define "oneuptime.probeApiUrl" -}} {{ printf "http://%s-probe-api.%s.%s" $.Release.Name $.Release.Namespace "svc.cluster.local" }} {{- end -}} diff --git a/helm-chart/public/oneuptime/templates/fetch-resources.yaml b/helm-chart/public/oneuptime/templates/probe-api.yaml similarity index 98% rename from helm-chart/public/oneuptime/templates/fetch-resources.yaml rename to helm-chart/public/oneuptime/templates/probe-api.yaml index e56f332f1e..d4a60d3a23 100644 --- a/helm-chart/public/oneuptime/templates/fetch-resources.yaml +++ b/helm-chart/public/oneuptime/templates/probe-api.yaml @@ -77,6 +77,8 @@ spec: value: {{ $.Values.nodeEnv }} - name: IS_TESTING value: {{ $.Values.isTesting | quote }} + - name: DB_NAME + value: {{ $.Values.mongo.databaseName }} ports: - containerPort: {{ $.Values.host.fetchResourcesPort }} hostPort: {{ $.Values.host.fetchResourcesPort }} diff --git a/helm-chart/public/oneuptime/templates/probe.yaml b/helm-chart/public/oneuptime/templates/probe.yaml index c9d064b094..448b1ee76c 100644 --- a/helm-chart/public/oneuptime/templates/probe.yaml +++ b/helm-chart/public/oneuptime/templates/probe.yaml @@ -60,6 +60,8 @@ spec: value: {{ $value.name }} - name: PROBE_KEY value: {{ $value.key }} + - name: PROBE_API_URL + value: {{ template "oneuptime.probeApiUrl" $ }} {{- if $.Values.newRelic.probe.licenseKey }} - name: NEW_RELIC_LICENSE_KEY value: {{ $.Values.newRelic.probe.licenseKey }} diff --git a/probe-api/.env b/probe-api/.env index e4c74344cf..ce364305f3 100644 --- a/probe-api/.env +++ b/probe-api/.env @@ -3,4 +3,5 @@ CLUSTER_KEY=f414c23b4cdf4e84a6a66ecfd528eff2 SLACK_ERROR_LOG_WEBHOOK=https://hooks.slack.com/services/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 SLACK_ERROR_LOG_CHANNEL=oneuptime-engineering PORT=3400 -REALTIME_URL=http://localhost:3300 \ No newline at end of file +REALTIME_URL=http://localhost:3300 +DB_NAME=oneuptimedb \ No newline at end of file diff --git a/probe-api/index.js b/probe-api/index.js index 2985961902..e400ad50db 100644 --- a/probe-api/index.js +++ b/probe-api/index.js @@ -69,7 +69,7 @@ const client = getMongoClient(); })(); // attach the database to global object -global.db = client.db('oneuptimedb'); +global.db = client.db(process.env.DB_NAME); // Sentry: The request handler must be the first middleware on the app app.use(Sentry.Handlers.requestHandler()); diff --git a/probe-api/utils/config.js b/probe-api/utils/config.js index aaf70fe1da..817cb8e2d3 100755 --- a/probe-api/utils/config.js +++ b/probe-api/utils/config.js @@ -3,6 +3,6 @@ const packageJson = require('../package.json'); module.exports = { clusterKey: process.env.CLUSTER_KEY, fetchResourcesVersion: packageJson.version, - mongoUrl: process.env.MONGO_URL || 'mongodb://localhost:27017/oneuptimedb', + mongoUrl: process.env.MONGO_URL, realtimeUrl: process.env['REALTIME_URL'], };