Skip to content

Commit

Permalink
Add version to /status endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocode committed Jun 5, 2022
1 parent 591c4da commit f999ec9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions server/controllers/status_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ import (

// StatusController handles the status of Atlantis.
type StatusController struct {
Logger logging.SimpleLogging
Drainer *events.Drainer
Logger logging.SimpleLogging
Drainer *events.Drainer
AtlantisVersion string
}

type StatusResponse struct {
ShuttingDown bool `json:"shutting_down"`
InProgressOps int `json:"in_progress_operations"`
ShuttingDown bool `json:"shutting_down"`
InProgressOps int `json:"in_progress_operations"`
AtlantisVersion string `json:"version"`
}

// Get is the GET /status route.
Expand All @@ -26,6 +28,7 @@ func (d *StatusController) Get(w http.ResponseWriter, r *http.Request) {
data, err := json.MarshalIndent(&StatusResponse{
ShuttingDown: status.ShuttingDown,
InProgressOps: status.InProgressOps,
AtlantisVersion: d.AtlantisVersion,
}, "", " ")
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
Expand Down
1 change: 1 addition & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ func NewServer(userConfig UserConfig, config Config) (*Server, error) {
statusController := &controllers.StatusController{
Logger: logger,
Drainer: drainer,
AtlantisVersion: config.AtlantisVersion,
}
preWorkflowHooksCommandRunner := &events.DefaultPreWorkflowHooksCommandRunner{
VCSClient: vcsClient,
Expand Down

0 comments on commit f999ec9

Please sign in to comment.