Skip to content

Commit

Permalink
Fix consul backend limit check
Browse files Browse the repository at this point in the history
  • Loading branch information
42wim committed Jul 2, 2021
1 parent dfc12a6 commit bed76bc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/backend/remote-state/consul/client.go
Expand Up @@ -96,6 +96,9 @@ func (c *RemoteClient) Get() (*remote.Payload, error) {
}
payload = append(payload, pair.Value[:]...)
}
if err = json.Unmarshal(payload, &payload); err != nil {
return nil, err
}
} else {
payload = pair.Value
}
Expand Down Expand Up @@ -203,6 +206,10 @@ func (c *RemoteClient) Put(data []byte) error {
// one but there is really no reason for them to do so, if they changed it
// it is certainly to set a larger value.
limit := 524288
// decode this to base64 as this will get us the correct size that will be sent.
if payload, err = json.Marshal(payload); err != nil {
return err
}
if len(payload) > limit {
md5 := md5.Sum(data)
chunks := split(payload, limit)
Expand Down

0 comments on commit bed76bc

Please sign in to comment.