Files
ocis/pkg/command/server.go
T

27 lines
646 B
Go
Raw Normal View History

2019-09-04 10:18:30 +02:00
package command
2019-09-03 18:10:34 +02:00
import (
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
2019-09-04 10:18:30 +02:00
// Server is the entrypoint for the server command.
func Server() *cobra.Command {
2019-09-03 18:10:34 +02:00
cmd := &cobra.Command{
Use: "server",
Short: "Start integrated server",
Long: "",
Run: func(cmd *cobra.Command, args []string) {
log.Info().
Str("addr", viper.GetString("server.addr")).
Msg("Executed server command")
},
}
cmd.Flags().String("server-addr", "", "Address to bind the server")
viper.BindPFlag("server.addr", cmd.Flags().Lookup("server-addr"))
viper.BindEnv("server.addr", "PHOENIX_SERVER_ADDR")
return cmd
}