Skip to content

Commit

Permalink
refactor: change viper default to main from function
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafasegf committed Oct 7, 2023
1 parent b096ba6 commit e651aa5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 2 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ func LoadConfig() (err error) {
viper.SetDefault("APP_ENV", "dev")
viper.SetDefault("LOG_LEVEL", int(zerolog.InfoLevel))
viper.SetDefault("DISABLE_LOGGING", false)
viper.SetDefault("SERVICE_URL", "http://localhost:8081/")
viper.SetDefault("CAS_URL", "https://sso.ui.ac.id/cas2/")

err = viper.ReadInConfig()
return err
Expand Down
8 changes: 0 additions & 8 deletions function.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ var (
)

func init() {
viper.AddConfigPath(".")
viper.SetConfigFile(".env")

viper.SetDefault("service_url", "http://localhost:8081/")
viper.SetDefault("cas_url", "https://sso.ui.ac.id/cas2/")

viper.ReadInConfig()

defaultServiceUrl = viper.GetString("service_url")
defaultCasUrl = viper.GetString("cas_url")
functions.HTTP("Proxy", Proxy)
Expand Down

0 comments on commit e651aa5

Please sign in to comment.