commands

package
v0.0.0-...-691b052 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "bitfan-ui",
	Short: "Bitfan Web UI",
	Long:  ``,
	PreRun: func(cmd *cobra.Command, args []string) {
		viper.BindPFlag("dev", cmd.Flags().Lookup("dev"))
		viper.BindPFlag("host", cmd.Flags().Lookup("host"))
		viper.BindPFlag("api", cmd.Flags().Lookup("api"))
	},

	Run: func(cmd *cobra.Command, args []string) {
		httpServerMux := http.NewServeMux()
		httpServerMux.Handle("/", server.Handler(
			viper.GetString("api"),
			viper.GetBool("dev"),
		))

		addr := viper.GetString("host")
		fmt.Printf("serving on http://%s\n", addr)
		http.ListenAndServe(addr, httpServerMux)
	},
}

RootCmd represents the base command when called without any subcommands

View Source
var Version = "No Version Provided"

Functions

func Execute

func Execute()

Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func GetService

func GetService() service.Service

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL