Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate JSON config #240

Merged
merged 3 commits into from
Aug 10, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
vendor: add gopkg.in/go-playground/validator
  • Loading branch information
adambabik committed Aug 7, 2017
commit 938dc36b16ddc340fd7c86ef2dcc760d55e97829
2 changes: 1 addition & 1 deletion geth/params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ type NodeConfig struct {
// PrivateKeyFile is a filename with node ID (private key)
// This file should contain a valid secp256k1 private key that will be used for both
// remote peer identification as well as network traffic encryption.
NodeKeyFile string `validate:"required"`
NodeKeyFile string

// Name sets the instance name of the node. It must not contain the / character.
Name string `validate:"excludes=/"`
Expand Down
9 changes: 3 additions & 6 deletions geth/params/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"testing"
"fmt"

validator "gopkg.in/go-playground/validator.v9"
"gopkg.in/go-playground/validator.v9"

"github.com/ethereum/go-ethereum/core"
gethparams "github.com/ethereum/go-ethereum/params"
Expand Down Expand Up @@ -442,16 +442,14 @@ func TestNodeConfigValidate(t *testing.T) {
Name: "Validate all required fields",
Config: `{}`,
Result: map[string]string{
"NetworkID": "required",
"NodeKeyFile": "required",
"DataDir": "required",
"NetworkID": "required",
"DataDir": "required",
},
},
{
Name: "Check invalid NetworkID validation",
Config: `{
"NetworkId": 999,
"NodeKeyFile": "some-key",
"DataDir": "/some/dir"
}`,
Result: map[string]string{
Expand All @@ -462,7 +460,6 @@ func TestNodeConfigValidate(t *testing.T) {
Name: "Validate Name does not contain slash",
Config: `{
"NetworkId": 1,
"NodeKeyFile": "some-key",
"DataDir": "/some/dir",
"Name": "invalid/name"
}`,
Expand Down
306 changes: 306 additions & 0 deletions vendor/github.com/go-playground/locales/currency/currency.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading