Skip to content

Commit

Permalink
nit
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
  • Loading branch information
joshua-kim committed Jul 17, 2024
1 parent e1eccdd commit b7d2f01
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
11 changes: 8 additions & 3 deletions examples/morpheusvm/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ type Config struct {
LogLevel logging.Level `json:"logLevel"`
}

func New(configBytes []byte) (*Config, error) {
// TODO test if this defaults correctly
func New(b []byte) (*Config, error) {
c := &Config{
StoreTransactions: true,
LogLevel: logging.Info,
}

return c, json.Unmarshal(configBytes, c)
if len(b) > 0 {
if err := json.Unmarshal(b, c); err != nil {
return nil, err
}
}

return c, nil
}
8 changes: 7 additions & 1 deletion examples/tokenvm/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,11 @@ func New(b []byte) (*Config, error) {
MaxOrdersPerPair: 1024,
}

return c, json.Unmarshal(b, c)
if len(b) > 0 {
if err := json.Unmarshal(b, c); err != nil {
return nil, err
}
}

return c, nil
}

0 comments on commit b7d2f01

Please sign in to comment.