Skip to content

Commit

Permalink
Validating that Address and Token are provided in path_config_access.go
Browse files Browse the repository at this point in the history
  • Loading branch information
ncorrare committed Nov 29, 2017
1 parent e1e63f8 commit a280884
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions builtin/logical/nomad/path_config_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,17 @@ func (b *backend) pathConfigAccessRead(

func (b *backend) pathConfigAccessWrite(
req *logical.Request, data *framework.FieldData) (*logical.Response, error) {
address := data.Get("address").(string)
if address == "" {
return logical.ErrorResponse("missing nomad server address"), nil
}
token := data.Get("token").(string)
if token == "" {
return logical.ErrorResponse("missing nomad management token"), nil
}
entry, err := logical.StorageEntryJSON("config/access", accessConfig{
Address: data.Get("address").(string),
Token: data.Get("token").(string),
Address: address,
Token: token,
})
if err != nil {
return nil, err
Expand Down

0 comments on commit a280884

Please sign in to comment.