Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
more api
Browse files Browse the repository at this point in the history
  • Loading branch information
boypt committed Jan 3, 2020
1 parent be13cee commit 37d3ffa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/C
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jpillora/ansi v0.0.0-20170202005112-f496b27cd669 h1:l5rH/CnVVu+HPxjtxjM90nHrm4nov3j3RF9/62UjgLs=
github.com/jpillora/ansi v0.0.0-20170202005112-f496b27cd669/go.mod h1:kOeLNvjNBGSV3uYtFjvb72+fnZCMFJF1XDvRIjdom0g=
github.com/jpillora/ansi v1.0.0 h1:agZNBxxIuqe/SM7U2fSaYmAO3X7f787xp3zZCZCYmYc=
github.com/jpillora/ansi v1.0.0/go.mod h1:kOeLNvjNBGSV3uYtFjvb72+fnZCMFJF1XDvRIjdom0g=
github.com/jpillora/archive v0.0.0-20160301031048-e0b3681851f1 h1:3ggQJKuQ4rwBDUa3N3adJRrI8XkOS/7oWhKWbeuBIN0=
github.com/jpillora/archive v0.0.0-20160301031048-e0b3681851f1/go.mod h1:MvVqA/jM3UcSNdHn6lskwC+/6qzjd9fmyCh+8cxrCRU=
github.com/jpillora/cookieauth v0.0.0-20190219222732-2ae29b2a9c76 h1:hbobq7RpymJc0jDg6lqo/sulXVGTCEmD67j6nwQ9BhQ=
Expand Down
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type Server struct {
ConfigPath string `opts:"help=Configuration file path"`
KeyPath string `opts:"help=TLS Key file path"`
CertPath string `opts:"help=TLS Certicate file path,short=r"`
RestAPI string `opts:"help=Listen on a trusted port accepts /api/ requests (eg. localhost:3001)"`
RestAPI string `opts:"help=Listen on a trusted port accepts /api/ requests (eg. localhost:3001),env=RESTAPI"`
Log bool `opts:"help=Enable request logging"`
Open bool `opts:"help=Open now with your default browser"`
DisableLogTime bool `opts:"help=Don't print timestamp in log"`
Expand Down
4 changes: 4 additions & 0 deletions server/server_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ func (s *Server) apiGET(w http.ResponseWriter, r *http.Request) error {
} else {
return errUnknowPath
}
case "stat":
s.state.Lock()
json.NewEncoder(w).Encode(s.state.Stats)
s.state.Unlock()
default:
return errUnknowAct
}
Expand Down

0 comments on commit 37d3ffa

Please sign in to comment.