Skip to content

Commit

Permalink
fix(BUX-361): appConfig initialisation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba-4chain committed Dec 15, 2023
1 parent 0f3f97c commit 7c249f7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/BuxOrg/bux-server/config"
"github.com/BuxOrg/bux-server/dictionary"
_ "github.com/BuxOrg/bux-server/docs"
"github.com/BuxOrg/bux-server/logging"
"github.com/BuxOrg/bux-server/server"
"github.com/BuxOrg/bux/logging"
)

// main method starts everything for the BUX Server
Expand Down
2 changes: 1 addition & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"testing"

"github.com/BuxOrg/bux/logging"
"github.com/BuxOrg/bux-server/logging"
"github.com/mrz1836/go-cachestore"
"github.com/mrz1836/go-datastore"
"github.com/newrelic/go-agent/v3/newrelic"
Expand Down
8 changes: 4 additions & 4 deletions config/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import (
"strings"
"sync"

"github.com/BuxOrg/bux-server/dictionary"
"github.com/mitchellh/mapstructure"
"github.com/rs/zerolog"
"github.com/spf13/viper"

"github.com/BuxOrg/bux-server/dictionary"
)

// Added a mutex lock for a race-condition
Expand All @@ -34,12 +35,11 @@ func Load(logger *zerolog.Logger) (appConfig *AppConfig, err error) {
return nil, err
}

appConfig = new(AppConfig)
if err = unmarshallToAppConfig(appConfig); err != nil {
if err = unmarshallToAppConfig(DefaultAppConfig); err != nil {
return nil, err
}

return appConfig, nil
return DefaultAppConfig, nil
}

func setDefaults() error {
Expand Down
2 changes: 1 addition & 1 deletion config/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"os"
"testing"

"github.com/BuxOrg/bux/logging"
"github.com/BuxOrg/bux-server/logging"
"github.com/spf13/viper"
"github.com/stretchr/testify/assert"
)
Expand Down

0 comments on commit 7c249f7

Please sign in to comment.