| 1234567891011121314151617181920212223242526272829 |
- package api
- import (
- "fmt"
- "encoding/json"
- "net/http"
- )
- // CapabilitiesExternal represents the Capabilities struct that will be sent over REST
- type CapabilitiesExternal struct {
- Provisioner bool `json:"provisioner"`
- GitHub bool `json:"github"`
- }
- // HandleGetCapabilities gets the capabilities of the server
- func (app *App) HandleGetCapabilities(w http.ResponseWriter, r *http.Request) {
- cap := app.CapConf
- fmt.Println(app.CapConf)
- capExternal := &CapabilitiesExternal{
- Provisioner: cap.Provisioner,
- GitHub: cap.Github,
- }
- if err := json.NewEncoder(w).Encode(capExternal); err != nil {
- app.handleErrorFormDecoding(err, ErrK8sDecode, w)
- return
- }
- }
|