dyndns/cmd/serve.go

26 lines
591 B
Go
Raw Normal View History

package cmd
import (
"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) {
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"))
}