Skip to content

Commit

Permalink
converting to json
Browse files Browse the repository at this point in the history
  • Loading branch information
henrod committed Jun 12, 2018
1 parent 7e39294 commit ac6d15c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
14 changes: 9 additions & 5 deletions api/scheduler_config_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"errors"
"net/http"

yaml "gopkg.in/yaml.v2"

"github.com/Sirupsen/logrus"
"github.com/topfreegames/maestro/models"
)
Expand Down Expand Up @@ -53,12 +51,18 @@ func (g *GetSchedulerConfigHandler) ServeHTTP(w http.ResponseWriter, r *http.Req
// json support
acceptHeader := r.Header.Get("Accept")
if acceptHeader == "application/json" {
var schedulerConfig map[string]interface{}
yaml.Unmarshal([]byte(yamlStr), &schedulerConfig)
jsonBytes, err := json.Marshal(schedulerConfig)
configYaml, err := models.NewConfigYAML(yamlStr)
if err != nil {
logger.WithError(err).Error("failed to unmarshal yaml")
g.App.HandleError(w, http.StatusInternalServerError, "failed to unmarshal yam", err)
return
}

jsonBytes, err := json.Marshal(configYaml)
if err != nil {
logger.WithError(err).Error("config scheduler failed.")
g.App.HandleError(w, http.StatusInternalServerError, "config scheduler failed", err)
return
}
w.Header().Set("Content-Type", "application/json")
WriteBytes(w, http.StatusOK, jsonBytes)
Expand Down
2 changes: 1 addition & 1 deletion helm/charts/maestro/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: maestro
home: https://github.com/topfreegames/maestro
description: Maestro api and worker
version: 4.14.1
version: 4.14.2
maintainers:
- name: TFGCo
email: backend@tfgco.com
2 changes: 1 addition & 1 deletion metadata/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
package metadata

//Version of Maestro
var Version = "4.14.1"
var Version = "4.14.2"

//KubeVersion is the desired Kubernetes version
var KubeVersion = "v1.7.5"

0 comments on commit ac6d15c

Please sign in to comment.