Skip to content

Commit 9658f2e

Browse files
author
Matthew Fisher
committed
feat(config): add routable field
1 parent 1c9d1c9 commit 9658f2e

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

api/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ type Config struct {
4444
// UUID is a unique string reflecting the configuration in its current state.
4545
// It changes every time the configuration is changed and cannot be updated.
4646
UUID string `json:"uuid,omitempty"`
47+
// Routable determines if the application should be exposed by the router.
48+
Routable bool `json:"routable,omitempty"`
4749
}
4850

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

config/config_test.go

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const configFixture string = `
3232
"registry": {
3333
"username": "bob"
3434
},
35+
"routable": true,
3536
"created": "2014-01-01T00:00:00UTC",
3637
"updated": "2014-01-01T00:00:00UTC",
3738
"uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75"
@@ -47,14 +48,15 @@ const configUnsetFixture string = `
4748
"cpu": {},
4849
"tags": {},
4950
"registry": {},
51+
"routable": true,
5052
"created": "2014-01-01T00:00:00UTC",
5153
"updated": "2014-01-01T00:00:00UTC",
5254
"uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75"
5355
}
5456
`
5557

56-
const configSetExpected string = `{"values":{"FOO":"bar","TEST":"testing"},"memory":{"web":"1G"},"cpu":{"web":"1000"},"tags":{"test":"tests"},"registry":{"username":"bob"}}`
57-
const configUnsetExpected string = `{"values":{"FOO":null,"TEST":null},"memory":{"web":null},"cpu":{"web":null},"tags":{"test":null},"registry":{"username":null}}`
58+
const configSetExpected string = `{"values":{"FOO":"bar","TEST":"testing"},"memory":{"web":"1G"},"cpu":{"web":"1000"},"tags":{"test":"tests"},"registry":{"username":"bob"},"routable":true}`
59+
const configUnsetExpected string = `{"values":{"FOO":null,"TEST":null},"memory":{"web":null},"cpu":{"web":null},"tags":{"test":null},"registry":{"username":null},"routable":true}`
5860

5961
type fakeHTTPServer struct{}
6062

@@ -144,9 +146,10 @@ func TestConfigSet(t *testing.T) {
144146
Registry: map[string]interface{}{
145147
"username": "bob",
146148
},
147-
Created: "2014-01-01T00:00:00UTC",
148-
Updated: "2014-01-01T00:00:00UTC",
149-
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
149+
Routable: true,
150+
Created: "2014-01-01T00:00:00UTC",
151+
Updated: "2014-01-01T00:00:00UTC",
152+
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
150153
}
151154

152155
configVars := api.Config{
@@ -166,6 +169,7 @@ func TestConfigSet(t *testing.T) {
166169
Registry: map[string]interface{}{
167170
"username": "bob",
168171
},
172+
Routable: true,
169173
}
170174

171175
actual, err := Set(deis, "example-go", configVars)
@@ -199,6 +203,7 @@ func TestConfigUnset(t *testing.T) {
199203
CPU: map[string]interface{}{},
200204
Tags: map[string]interface{}{},
201205
Registry: map[string]interface{}{},
206+
Routable: true,
202207
Created: "2014-01-01T00:00:00UTC",
203208
Updated: "2014-01-01T00:00:00UTC",
204209
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
@@ -221,6 +226,7 @@ func TestConfigUnset(t *testing.T) {
221226
Registry: map[string]interface{}{
222227
"username": nil,
223228
},
229+
Routable: true,
224230
}
225231

226232
actual, err := Set(deis, "unset-test", configVars)
@@ -265,9 +271,10 @@ func TestConfigList(t *testing.T) {
265271
Registry: map[string]interface{}{
266272
"username": "bob",
267273
},
268-
Created: "2014-01-01T00:00:00UTC",
269-
Updated: "2014-01-01T00:00:00UTC",
270-
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
274+
Routable: true,
275+
Created: "2014-01-01T00:00:00UTC",
276+
Updated: "2014-01-01T00:00:00UTC",
277+
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
271278
}
272279

273280
actual, err := List(deis, "example-go")

0 commit comments

Comments
 (0)