Update worker version, add TASK ID HEADER
This commit is contained in:
parent
f2e2236653
commit
a6e10369bb
2 changed files with 6 additions and 1 deletions
|
@ -2,13 +2,14 @@ package constants
|
|||
|
||||
import "fmt"
|
||||
|
||||
const WORKER_VERSION = "v1"
|
||||
const WORKER_VERSION = "v2"
|
||||
|
||||
const WORKER_VERSION_HEADER = "morffix-version"
|
||||
const SHARED_SECRET_HEADER = "morffix-secret"
|
||||
const NAME_HEADER = "morffix-name"
|
||||
const UUID_HEADER = "morffix-uuid"
|
||||
const HASH_HEADER = "morffix-hash"
|
||||
const TASK_ID_HEADER = "morffix-task-id"
|
||||
|
||||
const INDEX_TEMPLATE_NAME = "index.tmpl"
|
||||
const LIBRARIES_TEMPLATE_NAME = "libraries.tmpl"
|
||||
|
@ -26,6 +27,8 @@ const SORT_ORDER_ASC_PARAM = "order_asc"
|
|||
const QUERY_LIMIT_PARAM = "limit"
|
||||
const QUERY_PAGE_PARAM = "page"
|
||||
|
||||
const TEMP_FILE_EXTENSION = ".morffix"
|
||||
|
||||
type TaskType int
|
||||
|
||||
const (
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"mime/multipart"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"git.lastassault.de/speatzle/morffix/config"
|
||||
|
@ -82,6 +83,7 @@ func uploadFile(ctx context.Context, l *slog.Logger, conf config.Config, path st
|
|||
req.Header.Add(constants.UUID_HEADER, uuid.String())
|
||||
req.Header.Add(constants.WORKER_VERSION_HEADER, constants.WORKER_VERSION)
|
||||
req.Header.Add(constants.HASH_HEADER, base64.StdEncoding.EncodeToString(hash))
|
||||
req.Header.Add(constants.TASK_ID_HEADER, strconv.Itoa(t.ID))
|
||||
req.Header.Add("Content-Type", "multipart/form-data; boundary=\""+m.Boundary()+"\"")
|
||||
|
||||
var client = &http.Client{
|
||||
|
|
Loading…
Add table
Reference in a new issue