dyndns/cmd/serve.go
Torben Nehmer 7dd11a0879 First basic version
- NFT and DNS Update skeletons
- Integrated viper configuration management
- Integrated cobra CLI management
- Basic webservice skeleton
2021-08-20 21:10:59 +02:00

29 lines
661 B
Go

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"))
}