Skip to content

Commit

Permalink
error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
argonaut0 committed Aug 24, 2023
1 parent ab6a5ed commit 9444b01
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,13 @@ func (in *Instancer) registerEndpoints() {

manifest, ok := in.config.Challenges[chalName]
if !ok {
// todo: don't sprintf user controlled data
c.Logger().Infof("request rejected with invalid challenge %s", chalName)
return c.JSON(http.StatusNotFound, "challenge not supported")
}
// todo: check an auth token or something
if token == "" {
c.Logger().Info("request rejected with no token")
return c.JSON(http.StatusForbidden, "team token not provided")
}
// todo: create challenge
Expand All @@ -99,9 +102,10 @@ func (in *Instancer) registerEndpoints() {
}
if err != nil {
// todo: handle errors/cleanup incomplete deploys?
c.Logger().Errorf("could create an object: %s", err.Error())
return c.JSON(http.StatusInternalServerError, "challenge deploy failed: contact admin")
}

c.Logger().Info("provisioned new instance")
return c.JSON(http.StatusAccepted, "created")
})

Expand Down

0 comments on commit 9444b01

Please sign in to comment.