Skip to content

Commit

Permalink
Remove init funciton usage from env helper
Browse files Browse the repository at this point in the history
  • Loading branch information
kuskoman committed Feb 24, 2023
1 parent 9817de0 commit 3303711
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 6 additions & 0 deletions cmd/exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ import (

"github.com/kuskoman/logstash-exporter/collectors"
"github.com/kuskoman/logstash-exporter/config"
"github.com/kuskoman/logstash-exporter/helpers"
"github.com/kuskoman/logstash-exporter/server"
"github.com/prometheus/client_golang/prometheus"
)

func main() {
warn := helpers.InitializeEnv()
if warn != nil {
log.Println(warn)
}

port := config.Port
host := config.Host
logstashUrl := config.LogstashUrl
Expand Down
8 changes: 2 additions & 6 deletions helpers/env_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@ package helpers

import (
"errors"
"log"
"os"

"github.com/joho/godotenv"
)

func init() {
err := godotenv.Load()
if err != nil {
log.Println("Error loading .env file")
}
func InitializeEnv() error {
return godotenv.Load()
}

func GetEnv(key string) string {
Expand Down

0 comments on commit 3303711

Please sign in to comment.