Skip to content
Snippets Groups Projects
Commit 7ecb60da authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6747 resovle comments

parent 5ecd088d
No related branches found
No related tags found
No related merge requests found
...@@ -42,13 +42,21 @@ buf generate ...@@ -42,13 +42,21 @@ buf generate
### Anwendung starten ### Anwendung starten
``` ```
go run cmd/antragsraum-proxy/main.go ACTIVE_PROFILE=local go run cmd/antragsraum-proxy/main.go
``` ```
## Config ## Config
config.yml is the default config for deployment
[Config-Datei](./config/config.yml) [Config-Datei](./config/config.yml)
config-local.yml is the config file for local development
setting ACTIVE_PROFILE=local will load the config-local.yml
[Config-Datei](./config/config-local.yml)
``` ```
http: http:
server: server:
...@@ -63,6 +71,8 @@ logging: ...@@ -63,6 +71,8 @@ logging:
level: "ERROR" | "WARN" | "INFO" | "DEBUG" level: "ERROR" | "WARN" | "INFO" | "DEBUG"
``` ```
### Releasing ### Releasing
Diese Schritte ausführen: Diese Schritte ausführen:
......
...@@ -36,7 +36,7 @@ import ( ...@@ -36,7 +36,7 @@ import (
const ( const (
defaultConfig = "config.yml" defaultConfig = "config.yml"
testFilePath = "testdata/" testFilePath = "testdata/"
APP_ENV_NAME = "APP_ENV" activeProfile = "ACTIVE_PROFILE"
) )
type Config struct { type Config struct {
...@@ -64,7 +64,7 @@ func LoadConfig(configFilePath ...string) Config { ...@@ -64,7 +64,7 @@ func LoadConfig(configFilePath ...string) Config {
configFile := defaultConfig configFile := defaultConfig
env := os.Getenv(APP_ENV_NAME) env := os.Getenv(activeProfile)
if env != "" { if env != "" {
configFile = fmt.Sprintf("config-%s.yml", env) configFile = fmt.Sprintf("config-%s.yml", env)
} }
......
...@@ -32,7 +32,7 @@ import ( ...@@ -32,7 +32,7 @@ import (
) )
func TestLoadConfig(t *testing.T) { func TestLoadConfig(t *testing.T) {
t.Run("should load default config from file", func(t *testing.T) { t.Run("should load default config", func(t *testing.T) {
config := LoadConfig() config := LoadConfig()
expectedConfig := Config{} expectedConfig := Config{}
...@@ -46,12 +46,11 @@ func TestLoadConfig(t *testing.T) { ...@@ -46,12 +46,11 @@ func TestLoadConfig(t *testing.T) {
}) })
t.Run("should load local config", func(t *testing.T) { t.Run("should load local config", func(t *testing.T) {
os.Setenv(APP_ENV_NAME, "local") assert.NoError(t, os.Setenv(activeProfile, "local"), "Setenv "+activeProfile+" should not return an error")
defer os.Unsetenv(APP_ENV_NAME)
config := LoadConfig() config := LoadConfig()
assert.NoError(t, os.Unsetenv(APP_ENV_NAME), "Unsetenv "+APP_ENV_NAME+" should not return an error") assert.NoError(t, os.Unsetenv(activeProfile), "Unsetenv "+activeProfile+" should not return an error")
expectedConfig := Config{} expectedConfig := Config{}
expectedConfig.Grpc.Server.Mock = true expectedConfig.Grpc.Server.Mock = true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment