Skip to content

Commit

Permalink
Only execlude cayley on top level in gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
iddan authored and dennwc committed Nov 14, 2019
1 parent 85ea1bb commit fe0b72b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ cayley.json
.cayley_history
.DS_Store

# The built binary
cayley/
dist/
vendor/
ui/
packrd/packed-*
cayley
# The build binary
/cayley
29 changes: 29 additions & 0 deletions cmd/cayley/command/health.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package command

import (
"fmt"
"net/http"

"github.com/spf13/cobra"
)

const defaultAddress = "http://localhost:64210/"

func NewHealthCmd() *cobra.Command {
return &cobra.Command{
Use: "health",
Aliases: []string{},
Short: "Health check HTTP server",
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) > 1 {
return fmt.Errorf("Too many arguments provided, expected 0 or 1")
}
address := defaultAddress
if len(args) == 1 {
address = args[0]
}
_, err := http.Get(address + "/health")
return err
},
}
}

0 comments on commit fe0b72b

Please sign in to comment.