Skip to content

Commit

Permalink
word
Browse files Browse the repository at this point in the history
  • Loading branch information
tanfarming committed Feb 9, 2024
1 parent 0f9929f commit fc96248
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions ita/internal/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,26 @@ func getRetCcu() (int, error) {
}

func ret_rewrite_assets(oldDomain, newDomain string) error {
retCcuReq, _ := http.NewRequest("POST", "https://ret."+cfg.PodNS+":4000/api-internal/v1/rewrite_assets",
bytes.NewBuffer([]byte(
`{"old_domain":"`+oldDomain+`","new_domain":"`+newDomain+`"}`)))
jsonBody, _ := json.Marshal(map[string]string{
"old_domain": oldDomain,
"new_domain": newDomain,
})
retCcuReq, _ := http.NewRequest(
"POST",
"https://ret."+cfg.PodNS+":4000/api-internal/v1/rewrite_assets",
bytes.NewBuffer(jsonBody))
retCcuReq.Header.Add("x-ret-dashboard-access-key", cfg.RetApiKey)
retCcuReq.Header.Add("content-type", "application/json")

resp, err := _httpClient.Do(retCcuReq)

if err != nil {
return err
}
body, _ := io.ReadAll(resp.Body)
Logger.Sugar().Debugf("resp %v", string(body))
if resp.StatusCode > 200 {
return errors.New(string(body))
}

return err
}
Expand Down

0 comments on commit fc96248

Please sign in to comment.