Bind port to env var

This commit is contained in:
Marcus Noble 2020-10-17 21:20:10 +01:00
parent f5c2b1952a
commit caf32c1c3a
1 changed files with 2 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package cmd
import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/averagemarcus/gopherss/internal/server"
)
@ -20,6 +21,7 @@ var serverCmd = &cobra.Command{
func init() {
serverCmd.Flags().StringVarP(&port, "port", "p", "8080", "The port to run the web server on")
viper.BindPFlag("PORT", refreshCmd.Flags().Lookup("port"))
rootCmd.AddCommand(serverCmd)
}