bc88c694ee
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
Co-authored-by: Thomas Peetz <thomas.peetz@cimt-ag.de> Reviewed-on: #97
33 lines
757 B
Go
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)
|
|
}
|