use server infos from config file
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 8s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 8s
This commit is contained in:
@@ -10,11 +10,6 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"resty.dev/v3"
|
||||
)
|
||||
|
||||
var (
|
||||
servername string
|
||||
)
|
||||
|
||||
var addLinksCmd = &cobra.Command{
|
||||
@@ -31,18 +26,11 @@ var addLinksCmd = &cobra.Command{
|
||||
slog.Warn("add links failed", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
client := resty.New()
|
||||
localServer := config.Config.Server[servername]
|
||||
token := api.GetToken(client, localServer)
|
||||
localServer := config.Config.Server[config.ServerName]
|
||||
for _, line := range lines {
|
||||
lofiAdd := models.MediaLofiAdd{Url: line}
|
||||
addResult := &models.MediaLoFi{}
|
||||
response, err := client.R().
|
||||
SetBody(lofiAdd).
|
||||
SetAuthToken(token).
|
||||
SetHeader("Accept", "application/json").
|
||||
SetResult(addResult).
|
||||
Post("http://localhost:8550/api/v1/media/lofis")
|
||||
response, err := api.PushData(localServer, "media/lofis", lofiAdd, addResult)
|
||||
if err != nil {
|
||||
slog.Info("Add Lofi", "error", err.Error())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user