Skip to content

Commit d71c8cc

Browse files
author
Matthew Fisher
authored
Merge pull request #73 from bacongobbler/fixup-routable-omitempty
fix(api): make Routable a *bool
2 parents b5c3416 + f122b01 commit d71c8cc

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

api/config.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ type Config struct {
4545
// It changes every time the configuration is changed and cannot be updated.
4646
UUID string `json:"uuid,omitempty"`
4747
// Routable determines if the application should be exposed by the router.
48-
Routable bool `json:"routable,omitempty"`
48+
Routable *bool `json:"routable,omitempty"`
49+
}
50+
51+
func NewRoutable() *bool {
52+
b := true
53+
return &b
4954
}
5055

5156
// ConfigHookRequest defines the request for configuration from the config hook.

config/config_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func TestConfigSet(t *testing.T) {
146146
Registry: map[string]interface{}{
147147
"username": "bob",
148148
},
149-
Routable: true,
149+
Routable: api.NewRoutable(),
150150
Created: "2014-01-01T00:00:00UTC",
151151
Updated: "2014-01-01T00:00:00UTC",
152152
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
@@ -169,7 +169,7 @@ func TestConfigSet(t *testing.T) {
169169
Registry: map[string]interface{}{
170170
"username": "bob",
171171
},
172-
Routable: true,
172+
Routable: api.NewRoutable(),
173173
}
174174

175175
actual, err := Set(deis, "example-go", configVars)
@@ -203,7 +203,7 @@ func TestConfigUnset(t *testing.T) {
203203
CPU: map[string]interface{}{},
204204
Tags: map[string]interface{}{},
205205
Registry: map[string]interface{}{},
206-
Routable: true,
206+
Routable: api.NewRoutable(),
207207
Created: "2014-01-01T00:00:00UTC",
208208
Updated: "2014-01-01T00:00:00UTC",
209209
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
@@ -226,7 +226,7 @@ func TestConfigUnset(t *testing.T) {
226226
Registry: map[string]interface{}{
227227
"username": nil,
228228
},
229-
Routable: true,
229+
Routable: api.NewRoutable(),
230230
}
231231

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

0 commit comments

Comments
 (0)