Files
kontor/kontor-gin/internal/cmd/update-title.go
T
tpeetz f5e9cbc423
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
add config values for token retrieval
2026-10-11 23:04:39 +02:00

35 lines
809 B
Go

package cmd
import (
"kontor-api-gin/internal/api"
"kontor-api-gin/internal/config"
"log/slog"
"github.com/spf13/cobra"
"resty.dev/v3"
)
var updateTitleCmd = &cobra.Command{
Use: "update-title",
Short: "Update titles",
Long: "Update titles",
Run: func(cmd *cobra.Command, args []string) {
slog.Info("Update titles using server", "server", config.ServerName)
client := resty.New()
localServer := config.Config.Server[config.ServerName]
slog.Info("get token", "url", localServer.Url)
token := api.GetToken(client, localServer)
api.GetJSON(client, token, localServer, "media/lofis", &api.Medialofis)
for _, lofi := range api.Medialofis {
if lofi.Review {
slog.Info("get title for Url", "url", lofi.WebLink)
}
}
},
}
func init() {
rootCmd.AddCommand(updateTitleCmd)
}