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

OZG-6747 resovle comments

parent 5ecd088d
Branches
Tags
No related merge requests found
......@@ -42,13 +42,21 @@ buf generate
### 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-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:
server:
......@@ -63,6 +71,8 @@ logging:
level: "ERROR" | "WARN" | "INFO" | "DEBUG"
```
### Releasing
Diese Schritte ausführen:
......
......@@ -36,7 +36,7 @@ import (
const (
defaultConfig = "config.yml"
testFilePath = "testdata/"
APP_ENV_NAME = "APP_ENV"
activeProfile = "ACTIVE_PROFILE"
)
type Config struct {
......@@ -64,7 +64,7 @@ func LoadConfig(configFilePath ...string) Config {
configFile := defaultConfig
env := os.Getenv(APP_ENV_NAME)
env := os.Getenv(activeProfile)
if env != "" {
configFile = fmt.Sprintf("config-%s.yml", env)
}
......@@ -73,7 +73,7 @@ func LoadConfig(configFilePath ...string) Config {
if len(configFilePath) > 0 {
fp = configFilePath[0]
} else if testing.Testing() {
} else if testing.Testing() {
fp = testFilePath+configFile
}
......
......@@ -32,7 +32,7 @@ import (
)
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()
expectedConfig := Config{}
......@@ -46,12 +46,11 @@ func TestLoadConfig(t *testing.T) {
})
t.Run("should load local config", func(t *testing.T) {
os.Setenv(APP_ENV_NAME, "local")
defer os.Unsetenv(APP_ENV_NAME)
assert.NoError(t, os.Setenv(activeProfile, "local"), "Setenv "+activeProfile+" should not return an error")
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.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