From 645488731b76fcd8dcee0f08586acae74561dac8 Mon Sep 17 00:00:00 2001
From: OZGCloud <ozgcloud@mgm-tp.com>
Date: Thu, 14 Nov 2024 15:27:30 +0100
Subject: [PATCH] OZG-6747 resolve comments

---
 README.md                      |  5 -----
 internal/config/config.go      | 16 ++++++++--------
 internal/config/config_test.go |  9 ++++-----
 3 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/README.md b/README.md
index ce2d75e..42b5fb5 100644
--- a/README.md
+++ b/README.md
@@ -45,8 +45,6 @@ buf generate
 ACTIVE_PROFILE=local go run cmd/antragsraum-proxy/main.go
 ```
 
-
-
 ## Config 
 config.yml is the default config for deployment
 
@@ -71,8 +69,6 @@ logging:
   level: "ERROR" | "WARN" | "INFO" | "DEBUG"
 ```
 
-
-
 ### Releasing
 
 Diese Schritte ausführen:
@@ -91,4 +87,3 @@ Diese Schritte ausführen:
 * Release-Branch in den Master mergen nicht pushen!
 * Die Version von 'var version' in cmd/antragraum-proxy/main.go "vX.X.X" auf "vX.X.X-beta.x" ändern
 * Master Branch pushen
-
diff --git a/internal/config/config.go b/internal/config/config.go
index a21874c..8a668af 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -26,17 +26,17 @@
 package config
 
 import (
+	"fmt"
 	"gopkg.in/yaml.v3"
 	"log"
 	"os"
 	"testing"
-	"fmt"
 )
 
 const (
-	defaultConfig   = "config.yml"
-	testFilePath = "testdata/"
-	activeProfile = "ACTIVE_PROFILE"
+	defaultConfig      = "config.yml"
+	testFilePath       = "testdata/"
+	activeProfileParam = "ACTIVE_PROFILE"
 )
 
 type Config struct {
@@ -63,18 +63,18 @@ func LoadConfig(configFilePath ...string) Config {
 	var config Config
 
 	configFile := defaultConfig
-	
-	env := os.Getenv(activeProfile)
+
+	env := os.Getenv(activeProfileParam)
 	if env != "" {
 		configFile = fmt.Sprintf("config-%s.yml", env)
 	}
 
 	fp := fmt.Sprintf("config/%s", configFile)
-	
+
 	if len(configFilePath) > 0 {
 		fp = configFilePath[0]
 	} else if testing.Testing() {
-		fp = testFilePath+configFile
+		fp = testFilePath + configFile
 	}
 
 	file, err := os.ReadFile(fp)
diff --git a/internal/config/config_test.go b/internal/config/config_test.go
index f087729..613e517 100644
--- a/internal/config/config_test.go
+++ b/internal/config/config_test.go
@@ -26,9 +26,9 @@
 package config
 
 import (
-	"testing"
 	"github.com/stretchr/testify/assert"
 	"os"
+	"testing"
 )
 
 func TestLoadConfig(t *testing.T) {
@@ -46,12 +46,12 @@ func TestLoadConfig(t *testing.T) {
 	})
 
 	t.Run("should load local config", func(t *testing.T) {
-		assert.NoError(t, os.Setenv(activeProfile, "local"), "Setenv "+activeProfile+" should not return an error") 
+		assert.NoError(t, os.Setenv(activeProfileParam, "local"), "Setenv "+activeProfileParam+" should not return an error")
 
 		config := LoadConfig()
 
-		assert.NoError(t, os.Unsetenv(activeProfile), "Unsetenv "+activeProfile+" should not return an error")
-		
+		assert.NoError(t, os.Unsetenv(activeProfileParam), "Unsetenv "+activeProfileParam+" should not return an error")
+
 		expectedConfig := Config{}
 		expectedConfig.Grpc.Server.Mock = true
 		expectedConfig.Http.Server.Port = 8082
@@ -61,5 +61,4 @@ func TestLoadConfig(t *testing.T) {
 
 		assert.Equal(t, expectedConfig, config)
 	})
-
 }
-- 
GitLab