Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Commit

Permalink
removed hardcoded values
Browse files Browse the repository at this point in the history
  • Loading branch information
mbongard committed Feb 28, 2022
1 parent 720ecee commit e6d5c2e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
13 changes: 5 additions & 8 deletions influxdb/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package influxdb

import (
"fmt"
"os"

influx "github.com/influxdata/influxdb1-client/v2"
"github.com/sirupsen/logrus"
Expand All @@ -10,12 +11,9 @@ import (
var InfluxClient *influx.Client

func InitializeInfluxClient() {
influxAddress := "10.20.1.24:30308"
influxUser := "root"
influxPassword := "jalapeno"
// influxAddress := os.Getenv("INFLUX_ADDRESS")
// influxUser := os.Getenv("INFLUX_USER")
// influxPassword := os.Getenv("INFLUX_PASSWORD")
influxAddress := os.Getenv("INFLUX_ADDRESS")
influxUser := os.Getenv("INFLUX_USER")
influxPassword := os.Getenv("INFLUX_PASSWORD")

logrus.WithFields(logrus.Fields{"influxAddress": influxAddress, "influxUser": influxUser}).Debug("Initializing Influx client.")

Expand All @@ -31,8 +29,7 @@ func InitializeInfluxClient() {
}

func queryInflux(queryString string) *influx.Response {
databaseName := "mdt_db"
// databaseName := os.Getenv("INFLUX_DB")
databaseName := os.Getenv("INFLUX_DB")

logger := logrus.WithFields(logrus.Fields{"databaseName": databaseName, "queryString": queryString})
logger.Debug("Querying InfluxDB.")
Expand Down
7 changes: 3 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"net"
"os"

"github.com/jalapeno-api-gateway/jagw-core/logger"
"github.com/jalapeno-api-gateway/protorepo-jagw-go/jagw"
Expand All @@ -14,16 +15,14 @@ import (
)

func main() {
logger.Init(logrus.StandardLogger(), "trace") // TODO: Pass this default log level through the environment variables through the helm chart
// logger.Init(logrus.StandardLogger(), os.Getenv("LOG_LEVEL")) // TODO: Pass this default log level through the environment variables through the helm chart
logger.Init(logrus.StandardLogger(), os.Getenv("LOG_LEVEL")) // TODO: Pass this default log level through the environment variables through the helm chart

logrus.Trace("Starting Request Service.")

redis.InitializeRedisClient()
influxdb.InitializeInfluxClient()

serverAddress := "0.0.0.0:9000"
// serverAddress := os.Getenv("APP_SERVER_ADDRESS")
serverAddress := os.Getenv("APP_SERVER_ADDRESS")

logger := logrus.WithField("serverAddress", serverAddress)
logger.Trace("Listening for traffic.")
Expand Down

0 comments on commit e6d5c2e

Please sign in to comment.