2020-10-17 13:30:30 +00:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/spf13/cobra"
|
2020-10-17 20:20:10 +00:00
|
|
|
"github.com/spf13/viper"
|
2020-10-17 13:30:30 +00:00
|
|
|
|
|
|
|
"github.com/averagemarcus/gopherss/internal/server"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
port string
|
|
|
|
)
|
|
|
|
|
|
|
|
var serverCmd = &cobra.Command{
|
|
|
|
Use: "server",
|
|
|
|
Short: "Starts the web server",
|
|
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
|
|
return server.Start(port)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
serverCmd.Flags().StringVarP(&port, "port", "p", "8080", "The port to run the web server on")
|
2020-10-17 20:20:10 +00:00
|
|
|
viper.BindPFlag("PORT", refreshCmd.Flags().Lookup("port"))
|
2020-10-17 13:30:30 +00:00
|
|
|
|
|
|
|
rootCmd.AddCommand(serverCmd)
|
|
|
|
}
|