Skip to content

Commit 505eaa0

Browse files
authored
chore(workflow-cli): config push add merge param (#84)
1 parent 716fb9a commit 505eaa0

13 files changed

Lines changed: 31 additions & 24 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.25
55
require (
66
github.com/chai2010/gettext-go v1.0.3
77
github.com/containerd/console v1.0.4
8-
github.com/drycc/controller-sdk-go v0.0.0-20250917070349-910603c54927
8+
github.com/drycc/controller-sdk-go v0.0.0-20250925082016-6b35f24ddb99
99
github.com/drycc/pkg v0.0.0-20250917064731-345368da3dbf
1010
github.com/minio/selfupdate v0.6.0
1111
github.com/olekukonko/tablewriter v0.0.5

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6N
1111
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
1212
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
1313
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
14-
github.com/drycc/controller-sdk-go v0.0.0-20250917070349-910603c54927 h1:c1n5N5urQztpcBy93U+oBEWyRXXaa0k3PwCg9pzXqe0=
15-
github.com/drycc/controller-sdk-go v0.0.0-20250917070349-910603c54927/go.mod h1:eHcmYwg81ASlP55/U587xnBZnZoeZnPHXGeQ8nYWnsg=
14+
github.com/drycc/controller-sdk-go v0.0.0-20250925082016-6b35f24ddb99 h1:rl63cNXjiTKi/gPbk7Gw0KL0sKJe64w7a9ol/J1DAS0=
15+
github.com/drycc/controller-sdk-go v0.0.0-20250925082016-6b35f24ddb99/go.mod h1:eHcmYwg81ASlP55/U587xnBZnZoeZnPHXGeQ8nYWnsg=
1616
github.com/drycc/pkg v0.0.0-20250917064731-345368da3dbf h1:CYy3NoPhfFhkGAbEppTOQfY/HC2s0FJDcBgbtRKeweg=
1717
github.com/drycc/pkg v0.0.0-20250917064731-345368da3dbf/go.mod h1:BrrNrNskHKm+nJYhXfGuI114w8nupi0AMo8QZHID7CM=
1818
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=

internal/commands/commands.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ type Commander interface {
4646
CertAttach(string, string, string) error
4747
CertDetach(string, string, string) error
4848
ConfigInfo(string, string, string, int) error
49-
ConfigSet(string, string, string, []string, string) error
49+
ConfigSet(string, string, string, []string, bool, string) error
5050
ConfigUnset(string, string, string, []string, string) error
5151
ConfigPull(string, string, string, string, bool, bool) error
52-
ConfigPush(string, string, string, string, string) error
52+
ConfigPush(string, string, string, string, bool, string) error
5353
ConfigAttach(string, string, string) error
5454
ConfigDetach(string, string, string) error
5555
DomainsList(string, int) error

internal/commands/config.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func (d *DryccCmd) ConfigInfo(appID string, ptype string, group string, version
116116
}
117117

118118
// ConfigSet sets an app's config variables.
119-
func (d *DryccCmd) ConfigSet(appID string, ptype string, group string, configVars []string, confirm string) error {
119+
func (d *DryccCmd) ConfigSet(appID string, ptype string, group string, configVars []string, merge bool, confirm string) error {
120120
appID, s, err := loader.LoadAppSettings(d.ConfigFile, appID)
121121
if err != nil {
122122
return err
@@ -138,7 +138,7 @@ func (d *DryccCmd) ConfigSet(appID string, ptype string, group string, configVar
138138

139139
quit := progress(d.WOut)
140140
configObj := api.Config{Values: configMap}
141-
_, err = config.Set(s.Client, appID, configObj)
141+
_, err = config.Set(s.Client, appID, configObj, merge)
142142
quit <- true
143143
<-quit
144144
if d.checkAPICompatibility(s.Client, err) != nil {
@@ -180,7 +180,7 @@ func (d *DryccCmd) ConfigUnset(appID string, ptype string, group string, configV
180180
}
181181

182182
configObj := api.Config{Values: valuesMaps}
183-
_, err = config.Set(s.Client, appID, configObj)
183+
_, err = config.Set(s.Client, appID, configObj, true)
184184

185185
quit <- true
186186
<-quit
@@ -263,7 +263,7 @@ func (d *DryccCmd) ConfigPull(appID, ptype, group, fileName string, interactive
263263
}
264264

265265
// ConfigPush pushes an app's config from a file.
266-
func (d *DryccCmd) ConfigPush(appID, ptype string, group string, fileName string, confirm string) error {
266+
func (d *DryccCmd) ConfigPush(appID, ptype string, group string, fileName string, merge bool, confirm string) error {
267267
stat, err := os.Stdin.Stat()
268268
if err != nil {
269269
return err
@@ -309,7 +309,7 @@ func (d *DryccCmd) ConfigPush(appID, ptype string, group string, fileName string
309309
}
310310
}
311311

312-
return d.ConfigSet(appID, ptype, group, config, "yes")
312+
return d.ConfigSet(appID, ptype, group, config, merge, "yes")
313313
}
314314

315315
// ConfigAttach attaches config groups to a process type.
@@ -327,7 +327,7 @@ func (d *DryccCmd) ConfigAttach(appID string, ptype string, groups string) error
327327
ptype: gs,
328328
}
329329
configObj := api.Config{ValuesRefs: refs}
330-
_, err = config.Set(s.Client, appID, configObj)
330+
_, err = config.Set(s.Client, appID, configObj, true)
331331

332332
quit <- true
333333
<-quit

internal/commands/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func TestConfigSet(t *testing.T) {
139139
var b bytes.Buffer
140140
cmdr := DryccCmd{WOut: &b, ConfigFile: cf}
141141

142-
err = cmdr.ConfigSet("foo", "web", "", []string{"TRUE=false", "DEBUG=true"}, "yes")
142+
err = cmdr.ConfigSet("foo", "web", "", []string{"TRUE=false", "DEBUG=true"}, true, "yes")
143143
assert.NoError(t, err)
144144

145145
assert.Equal(t, testutil.StripProgress(b.String()), `Creating config... done

internal/commands/healthchecks.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func (d *DryccCmd) HealthchecksSet(appID, healthcheckType, ptype string, probe *
120120
configObj := api.Config{Healthcheck: make(map[string]*api.Healthchecks)}
121121
configObj.Healthcheck[ptype] = &healthcheckMap
122122

123-
_, err = config.Set(s.Client, appID, configObj)
123+
_, err = config.Set(s.Client, appID, configObj, true)
124124

125125
quit <- true
126126
<-quit
@@ -157,7 +157,7 @@ func (d *DryccCmd) HealthchecksUnset(appID, ptype string, healthchecks []string)
157157

158158
configObj.Healthcheck = healthchecksMap
159159

160-
_, err = config.Set(s.Client, appID, configObj)
160+
_, err = config.Set(s.Client, appID, configObj, true)
161161

162162
quit <- true
163163
<-quit

internal/commands/limits.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func (d *DryccCmd) LimitsSet(appID string, limits []string) error {
7575

7676
quit := progress(d.WOut)
7777

78-
_, err = config.Set(s.Client, appID, configObj)
78+
_, err = config.Set(s.Client, appID, configObj, true)
7979
quit <- true
8080
<-quit
8181
if d.checkAPICompatibility(s.Client, err) != nil {
@@ -107,7 +107,7 @@ func (d *DryccCmd) LimitsUnset(appID string, limits []string) error {
107107
configObj.Limits = limitsMap
108108
}
109109

110-
_, err = config.Set(s.Client, appID, configObj)
110+
_, err = config.Set(s.Client, appID, configObj, true)
111111
quit <- true
112112
<-quit
113113
if d.checkAPICompatibility(s.Client, err) != nil {

internal/commands/registry.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func (d *DryccCmd) RegistrySet(appID, ptype, username, password string) error {
6767
}
6868
configObj.Registry = registry
6969

70-
_, err = config.Set(s.Client, appID, configObj)
70+
_, err = config.Set(s.Client, appID, configObj, true)
7171
quit <- true
7272
<-quit
7373
if d.checkAPICompatibility(s.Client, err) != nil {
@@ -97,7 +97,7 @@ func (d *DryccCmd) RegistryUnset(appID, ptype string) error {
9797
"password": nil,
9898
}
9999
configObj.Registry = registry
100-
_, err = config.Set(s.Client, appID, configObj)
100+
_, err = config.Set(s.Client, appID, configObj, true)
101101
quit <- true
102102
<-quit
103103
if d.checkAPICompatibility(s.Client, err) != nil {

internal/commands/tags.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (d *DryccCmd) TagsSet(appID, ptype string, tags []string) error {
6969
configObj := api.Config{Tags: make(map[string]api.ConfigTags)}
7070
configObj.Tags[ptype] = tagsMap
7171

72-
_, err = config.Set(s.Client, appID, configObj)
72+
_, err = config.Set(s.Client, appID, configObj, true)
7373
quit <- true
7474
<-quit
7575
if d.checkAPICompatibility(s.Client, err) != nil {
@@ -99,7 +99,7 @@ func (d *DryccCmd) TagsUnset(appID, ptype string, tags []string) error {
9999
}
100100
configObj.Tags[ptype] = configTags
101101

102-
_, err = config.Set(s.Client, appID, configObj)
102+
_, err = config.Set(s.Client, appID, configObj, true)
103103
quit <- true
104104
<-quit
105105
if d.checkAPICompatibility(s.Client, err) != nil {

internal/commands/timeouts.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (d *DryccCmd) TimeoutsSet(appID string, timeouts []string) error {
5656

5757
configObj.Timeout = timeoutsMap
5858

59-
_, err = config.Set(s.Client, appID, configObj)
59+
_, err = config.Set(s.Client, appID, configObj, true)
6060
quit <- true
6161
<-quit
6262
if d.checkAPICompatibility(s.Client, err) != nil {
@@ -89,7 +89,7 @@ func (d *DryccCmd) TimeoutsUnset(appID string, timeouts []string) error {
8989

9090
configObj.Timeout = valuesMap
9191

92-
_, err = config.Set(s.Client, appID, configObj)
92+
_, err = config.Set(s.Client, appID, configObj, true)
9393
quit <- true
9494
<-quit
9595
if d.checkAPICompatibility(s.Client, err) != nil {

0 commit comments

Comments
 (0)