Skip to content

Commit

Permalink
Merge pull request #75 from netlify/update_full_instance
Browse files Browse the repository at this point in the history
Overwrite instance configuration on update.
  • Loading branch information
calavera committed Aug 31, 2017
2 parents 06dab68 + 11d9178 commit e6ff3c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 1 addition & 4 deletions api/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"net/http"

"github.com/go-chi/chi"
"github.com/imdario/mergo"
"github.com/netlify/gotrue/conf"
"github.com/netlify/gotrue/models"
"github.com/pborman/uuid"
Expand Down Expand Up @@ -93,9 +92,7 @@ func (a *API) UpdateInstance(w http.ResponseWriter, r *http.Request) error {
}

if params.BaseConfig != nil {
if err := mergo.MergeWithOverwrite(i.BaseConfig, params.BaseConfig); err != nil {
return internalServerError("Error merging instance configurations").WithInternalError(err)
}
i.BaseConfig = params.BaseConfig
}

if err := a.db.UpdateInstance(i); err != nil {
Expand Down
3 changes: 3 additions & 0 deletions api/instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ func (ts *InstanceTestSuite) TestUpdate() {
var buffer bytes.Buffer
require.NoError(ts.T(), json.NewEncoder(&buffer).Encode(map[string]interface{}{
"config": &conf.Configuration{
JWT: conf.JWTConfiguration{
Secret: "testsecret",
},
SiteURL: "https://test.mysite.com",
},
}))
Expand Down

0 comments on commit e6ff3c1

Please sign in to comment.