add server configuration
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s

This commit is contained in:
Thomas Peetz
2026-10-08 17:40:17 +02:00
parent 7116869b42
commit ffa4786113
11 changed files with 292 additions and 97 deletions
+8 -2
View File
@@ -2,10 +2,12 @@ package cmd
import (
"kontor-api-gin/internal/api"
"kontor-api-gin/internal/config"
"log/slog"
"reflect"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
var syncCmd = &cobra.Command{
@@ -15,8 +17,12 @@ var syncCmd = &cobra.Command{
// Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
slog.Info("sync kontor")
sourceData, _ := api.GetData(server, apiVersion)
targetData, _ := api.GetData("https://kontor-gin.thpeetz.de", apiVersion)
apiVersion := viper.GetString("api")
mainServer := config.Config.Server["main"]
slog.Info("syncCmd#Run", "mainServer", mainServer)
localServer := config.Config.Server["local"]
sourceData, _ := api.GetData(mainServer, apiVersion)
targetData, _ := api.GetData(localServer, apiVersion)
slog.Info("Size of targetData", "size", reflect.TypeOf(targetData).Size())
// find missing items in target and collect items not available in source
for table, item_list := range sourceData.GetMap() {