Skip to content

Commit

Permalink
fix(api): make Routable a *bool
Browse files Browse the repository at this point in the history
fixes the issue where the client would send an empty request on `deis routing:disable`.

see golang/go#13284
  • Loading branch information
Matthew Fisher committed Aug 11, 2016
1 parent cd0f563 commit f122b01
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 6 additions & 1 deletion api/config.go
Expand Up @@ -45,7 +45,12 @@ type Config struct {
// It changes every time the configuration is changed and cannot be updated.
UUID string `json:"uuid,omitempty"`
// Routable determines if the application should be exposed by the router.
Routable bool `json:"routable,omitempty"`
Routable *bool `json:"routable,omitempty"`
}

func NewRoutable() *bool {
b := true
return &b
}

// ConfigHookRequest defines the request for configuration from the config hook.
Expand Down
10 changes: 5 additions & 5 deletions config/config_test.go
Expand Up @@ -146,7 +146,7 @@ func TestConfigSet(t *testing.T) {
Registry: map[string]interface{}{
"username": "bob",
},
Routable: true,
Routable: api.NewRoutable(),
Created: "2014-01-01T00:00:00UTC",
Updated: "2014-01-01T00:00:00UTC",
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
Expand All @@ -169,7 +169,7 @@ func TestConfigSet(t *testing.T) {
Registry: map[string]interface{}{
"username": "bob",
},
Routable: true,
Routable: api.NewRoutable(),
}

actual, err := Set(deis, "example-go", configVars)
Expand Down Expand Up @@ -203,7 +203,7 @@ func TestConfigUnset(t *testing.T) {
CPU: map[string]interface{}{},
Tags: map[string]interface{}{},
Registry: map[string]interface{}{},
Routable: true,
Routable: api.NewRoutable(),
Created: "2014-01-01T00:00:00UTC",
Updated: "2014-01-01T00:00:00UTC",
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
Expand All @@ -226,7 +226,7 @@ func TestConfigUnset(t *testing.T) {
Registry: map[string]interface{}{
"username": nil,
},
Routable: true,
Routable: api.NewRoutable(),
}

actual, err := Set(deis, "unset-test", configVars)
Expand Down Expand Up @@ -271,7 +271,7 @@ func TestConfigList(t *testing.T) {
Registry: map[string]interface{}{
"username": "bob",
},
Routable: true,
Routable: api.NewRoutable(),
Created: "2014-01-01T00:00:00UTC",
Updated: "2014-01-01T00:00:00UTC",
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
Expand Down

0 comments on commit f122b01

Please sign in to comment.