Files
kontor/kontor-gin/internal/cmd/config.go
T
tpeetz bc88c694ee
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
add MediaLofi in kontor-gin (#97)
Co-authored-by: Thomas Peetz <thomas.peetz@cimt-ag.de>
Reviewed-on: #97
2026-10-09 16:26:11 +00:00

33 lines
757 B
Go

package cmd
import (
"kontor-api-gin/internal/config"
"log/slog"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
var configCmd = &cobra.Command{
Use: "config",
TraverseChildren: true,
Short: "show current config",
Long: "show current config",
// Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
slog.Info("show config")
var config config.CliConfig
if err := viper.Unmarshal(&config); err != nil {
slog.Info("unable to decode config", "error", err.Error())
}
for name, server := range config.Server {
slog.Info("show config", "server", name, "URL", server.Url)
}
slog.Info("show config", "config", config)
},
}
func init() {
rootCmd.AddCommand(configCmd)
}