Skip to content

Commit bd35b03

Browse files
authored
chore(config): ConfigVar not omitempty (#44)
1 parent 94f8d2d commit bd35b03

3 files changed

Lines changed: 17 additions & 17 deletions

File tree

api/config.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ import (
1010
type ConfigTags map[string]interface{}
1111

1212
// ConfigValues value for env
13-
type KV struct {
14-
Name string `json:"name,omitempty"`
15-
Value interface{} `json:"value,omitempty"`
13+
type ConfigVar struct {
14+
Name string `json:"name"`
15+
Value interface{} `json:"value"`
1616
}
1717

1818
type ConfigValue struct {
1919
Ptype string `json:"ptype,omitempty"`
2020
Group string `json:"group,omitempty"`
21-
KV
21+
ConfigVar
2222
}
2323

2424
type PtypeValue struct {
25-
Env []KV `json:"env,omitempty"`
26-
Ref []string `json:"ref,omitempty"`
25+
Env []ConfigVar `json:"env,omitempty"`
26+
Ref []string `json:"ref,omitempty"`
2727
}
2828

2929
type ConfigInfo struct {
30-
Ptype map[string]PtypeValue `json:"ptype,omitempty"`
31-
Group map[string][]KV `json:"group,omitempty"`
30+
Ptype map[string]PtypeValue `json:"ptype,omitempty"`
31+
Group map[string][]ConfigVar `json:"group,omitempty"`
3232
}
3333

3434
// ValuesRefs is the key, value for refs

config/config_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,14 @@ func TestConfigSet(t *testing.T) {
212212
Values: []api.ConfigValue{
213213
{
214214
Group: "global",
215-
KV: api.KV{
215+
ConfigVar: api.ConfigVar{
216216
Name: "NEW_URL2",
217217
Value: "http://localhost:8080/",
218218
},
219219
},
220220
{
221221
Ptype: "web",
222-
KV: api.KV{
222+
ConfigVar: api.ConfigVar{
223223
Name: "NEW_URL",
224224
Value: "http://localhost:8080",
225225
},
@@ -247,14 +247,14 @@ func TestConfigSet(t *testing.T) {
247247
Values: []api.ConfigValue{
248248
{
249249
Group: "global",
250-
KV: api.KV{
250+
ConfigVar: api.ConfigVar{
251251
Name: "NEW_URL2",
252252
Value: "http://localhost:8080/",
253253
},
254254
},
255255
{
256256
Ptype: "web",
257-
KV: api.KV{
257+
ConfigVar: api.ConfigVar{
258258
Name: "NEW_URL",
259259
Value: "http://localhost:8080",
260260
},
@@ -314,7 +314,7 @@ func TestConfigUnset(t *testing.T) {
314314
Values: []api.ConfigValue{
315315
{
316316
Group: "global",
317-
KV: api.KV{
317+
ConfigVar: api.ConfigVar{
318318
Name: "TEST",
319319
Value: "",
320320
},
@@ -362,14 +362,14 @@ func TestConfigList(t *testing.T) {
362362
Values: []api.ConfigValue{
363363
{
364364
Group: "global",
365-
KV: api.KV{
365+
ConfigVar: api.ConfigVar{
366366
Name: "NEW_URL2",
367367
Value: "http://localhost:8080/",
368368
},
369369
},
370370
{
371371
Ptype: "web",
372-
KV: api.KV{
372+
ConfigVar: api.ConfigVar{
373373
Name: "NEW_URL",
374374
Value: "http://localhost:8080",
375375
},

hooks/hooks_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,14 @@ func TestConfigHook(t *testing.T) {
169169
Values: []api.ConfigValue{
170170
{
171171
Group: "global",
172-
KV: api.KV{
172+
ConfigVar: api.ConfigVar{
173173
Name: "TEST",
174174
Value: "testing",
175175
},
176176
},
177177
{
178178
Group: "global",
179-
KV: api.KV{
179+
ConfigVar: api.ConfigVar{
180180
Name: "FOO",
181181
Value: "bar",
182182
},

0 commit comments

Comments
 (0)