package cmd import ( "log" "gitea.nehmer.net/torben/dyndns/service" "gitea.nehmer.net/torben/dyndns/webapi" "github.com/spf13/cobra" "github.com/spf13/viper" ) var cmdServe = &cobra.Command{ Use: "server", Short: "Start webserver", Long: ``, Run: func(cmd *cobra.Command, args []string) { log.Printf("Configuration in use: %v", viper.AllSettings()) webapi.LoadConfig() service.LoadConfig() webapi.Server() }, } func init() { rootCmd.AddCommand(cmdServe) cmdServe.Flags().StringP("ListenAddress", "l", "", "ListenAddress for the application server") viper.BindPFlag("WebAPI.ListenAddress", cmdServe.Flags().Lookup("ListenAddress")) }