Skip to content

Commit

Permalink
update build
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrl-alt-lulz committed Nov 24, 2023
1 parent c6bf3ff commit be88609
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions apps/snapshots/downloader/init_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package snapshot_init

import (
"context"
"encoding/json"

"github.com/labstack/echo/v4"
"github.com/rs/zerolog/log"
init_jwt "github.com/zeus-fyi/zeus/pkg/aegis/jwt"
"github.com/zeus-fyi/zeus/pkg/utils/ephemery_reset"
Expand All @@ -17,6 +19,10 @@ type WorkloadInfo struct {
DataDir filepaths.Path
}

type Payload struct {
Body echo.Map `json:"body"`
}

func InitWorkloadAction(ctx context.Context, w WorkloadInfo) {
switch w.WorkloadType {
case "send-payload":
Expand All @@ -25,10 +31,17 @@ func InitWorkloadAction(ctx context.Context, w WorkloadInfo) {
if len(payl) <= 0 {
panic("no payload found")
}
pl := &Payload{
Body: echo.Map{},
}
err := json.Unmarshal(payl, &pl.Body)
if err != nil {
panic(err)
}
rb := resty_base.GetBaseRestyClient(payloadBasePath, bearer)
resp, err := rb.R().SetBody(payl).Post(payloadPostPath)
resp, err := rb.R().SetBody(pl).Post(payloadPostPath)
if err != nil {
log.Err(err).Interface("resp", resp).Msg("error sending payload")
log.Err(err).Interface("pl", pl).Interface("resp", resp).Msg("error sending payload")
panic(err)
}
if resp.StatusCode() >= 400 {
Expand Down

0 comments on commit be88609

Please sign in to comment.