Skip to content

Commit

Permalink
fix: to more natural bool
Browse files Browse the repository at this point in the history
  • Loading branch information
dd84ai committed Jun 8, 2024
1 parent 517ea77 commit d3c018d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion utils/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

func RegenerativeTest(callback func() error) error {
if !utils_settings.Envs.AreTestsRegenerating.ToBool() {
if !utils_settings.Envs.AreTestsRegenerating {
utils_logus.Log.Debug("Skipping test data regenerative code")
return nil
}
Expand Down
10 changes: 2 additions & 8 deletions utils/utils_env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ package utils_env

import "os"

type EnvBool string

func (e EnvBool) ToBool() bool {
return e == "true"
}

type EnvConfig struct{}

func NewEnvConfig() EnvConfig {
Expand All @@ -22,8 +16,8 @@ func (e EnvConfig) GetEnvWithDefault(key string, default_ string) string {
}
}

func (e EnvConfig) GetEnvBool(key string) EnvBool {
return EnvBool(os.Getenv(key))
func (e EnvConfig) GetEnvBool(key string) bool {
return os.Getenv(key) == "true"
}

func (e EnvConfig) GetEnv(key string) string {
Expand Down
4 changes: 2 additions & 2 deletions utils/utils_settings/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package utils_settings
import "github.com/darklab8/go-utils/utils/utils_env"

type UtilsEnvs struct {
IsDevEnv utils_env.EnvBool
AreTestsRegenerating utils_env.EnvBool
IsDevEnv bool
AreTestsRegenerating bool
}

var Envs UtilsEnvs
Expand Down

0 comments on commit d3c018d

Please sign in to comment.