Exemplo n.º 1
0
func main() {
	app := cli.NewApp()
	app.Name = os.Args[0]
	app.Usage = "trust orchestrator"
	app.Version = version.FullVersion()
	app.Author = "@ehazlett"
	app.Email = ""
	app.Before = func(c *cli.Context) error {
		if c.Bool("debug") {
			log.SetLevel(log.DebugLevel)
		}
		return nil
	}
	app.Commands = []cli.Command{
		server.CmdServer,
	}
	app.Flags = []cli.Flag{
		cli.BoolFlag{
			Name:  "debug, D",
			Usage: "enable debug",
		},
	}

	if err := app.Run(os.Args); err != nil {
		log.Fatal(err)
	}
}
Exemplo n.º 2
0
func (a *API) Run() error {
	router, err := a.setupRoutes()
	if err != nil {
		return err
	}

	http.Handle("/", router)

	log.Infof("exile %s: addr=%s", version.FullVersion(), a.addr)
	return http.ListenAndServe(a.addr, nil)
}
Exemplo n.º 3
0
func (a *API) index(w http.ResponseWriter, r *http.Request) {
	info := "exile " + version.FullVersion()
	w.Write([]byte(info))
}