Skip to content

Commit 68cd999

Browse files
committed
fixup
1 parent 68a2ae7 commit 68cd999

7 files changed

Lines changed: 15 additions & 48 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-20260324023744-f5a3de0a532e
8+
github.com/drycc/controller-sdk-go v0.0.0-20260410005909-366c9e9b1b3b
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
@@ -9,8 +9,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6N
99
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
1010
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
1111
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
12-
github.com/drycc/controller-sdk-go v0.0.0-20260324023744-f5a3de0a532e h1:4GH098Zz4VsTvk8KfLHQQTP5f/O41i7dk+h/GOYiDy8=
13-
github.com/drycc/controller-sdk-go v0.0.0-20260324023744-f5a3de0a532e/go.mod h1:eHcmYwg81ASlP55/U587xnBZnZoeZnPHXGeQ8nYWnsg=
12+
github.com/drycc/controller-sdk-go v0.0.0-20260410005909-366c9e9b1b3b h1:l2Q5y01LeRIbYrIwpgTJdLntPRFokoInbPkV4MKv1Fg=
13+
github.com/drycc/controller-sdk-go v0.0.0-20260410005909-366c9e9b1b3b/go.mod h1:eHcmYwg81ASlP55/U587xnBZnZoeZnPHXGeQ8nYWnsg=
1414
github.com/drycc/pkg v0.0.0-20250917064731-345368da3dbf h1:CYy3NoPhfFhkGAbEppTOQfY/HC2s0FJDcBgbtRKeweg=
1515
github.com/drycc/pkg v0.0.0-20250917064731-345368da3dbf/go.mod h1:BrrNrNskHKm+nJYhXfGuI114w8nupi0AMo8QZHID7CM=
1616
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=

internal/commands/apps.go

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"strings"
88
"time"
99

10+
"github.com/drycc/controller-sdk-go/api"
1011
"github.com/drycc/controller-sdk-go/apps"
1112
"github.com/drycc/controller-sdk-go/appsettings"
1213
"github.com/drycc/controller-sdk-go/domains"
@@ -306,23 +307,10 @@ func (d *DryccCmd) appURL(s *settings.Settings, appID string) (string, error) {
306307
if d.checkAPICompatibility(s.Client, err) != nil {
307308
return "", err
308309
}
309-
310-
if len(domains) == 0 {
311-
return "", nil
312-
}
313-
314-
return expandURL(s.Client.ControllerURL.Host, domains[0].Domain), nil
315-
}
316-
317-
// expandURL expands an app url if necessary.
318-
func expandURL(host, u string) string {
319-
if strings.Contains(u, ".") {
320-
// If domain is a full url.
321-
return u
310+
for _, domain := range domains {
311+
if domain.Ptype == api.PtypeWeb {
312+
return domain.Domain, nil
313+
}
322314
}
323-
324-
// If domain is a subdomain, look up the controller url and replace the subdomain.
325-
parts := strings.Split(host, ".")
326-
parts[0] = u
327-
return strings.Join(parts, ".")
315+
return "", nil
328316
}

internal/commands/apps_test.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -271,27 +271,6 @@ func TestAppTransfer(t *testing.T) {
271271
`, "output")
272272
}
273273

274-
func TestExpandUrl(t *testing.T) {
275-
checks := []expandURLCases{
276-
{
277-
Input: "test.com",
278-
Expected: "test.com",
279-
},
280-
{
281-
Input: "test",
282-
Expected: "test.foo.com",
283-
},
284-
}
285-
286-
for _, check := range checks {
287-
out := expandURL("drycc.foo.com", check.Input)
288-
289-
if out != check.Expected {
290-
t.Errorf("Expected %s, Got %s", check.Expected, out)
291-
}
292-
}
293-
}
294-
295274
func TestRemoteExists(t *testing.T) {
296275
cf, server, err := testutil.NewTestServerAndClient()
297276
if err != nil {

internal/commands/keys_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func TestListKeys(t *testing.T) {
8888

8989
folder := filepath.Join(name, ".ssh")
9090

91-
err = os.Mkdir(folder, 0o600)
91+
err = os.Mkdir(folder, 0o700)
9292
assert.NoError(t, err)
9393

9494
toWrite := []byte("ssh-rsa abc test@example.com")
@@ -115,7 +115,7 @@ func TestListKeys(t *testing.T) {
115115
keys, err := listKeys(io.Discard)
116116
assert.NoError(t, err)
117117

118-
assert.Equal(t, keys, expected, "key")
118+
assert.Equal(t, expected, keys, "key")
119119

120120
var b bytes.Buffer
121121
// Write bad ssh key
@@ -301,7 +301,7 @@ func TestKeyAdd(t *testing.T) {
301301
assert.NoError(t, err)
302302
settings.SetHome(name)
303303
folder := filepath.Join(name, ".ssh")
304-
err = os.Mkdir(folder, 0o600)
304+
err = os.Mkdir(folder, 0o700)
305305
assert.NoError(t, err)
306306

307307
cf, server, err := testutil.NewTestServerAndClient()
@@ -347,7 +347,7 @@ func TestKeyAddName(t *testing.T) {
347347
assert.NoError(t, err)
348348
settings.SetHome(name)
349349
folder := filepath.Join(name, ".ssh")
350-
err = os.Mkdir(folder, 0o600)
350+
err = os.Mkdir(folder, 0o700)
351351
assert.NoError(t, err)
352352

353353
cf, server, err := testutil.NewTestServerAndClient()

internal/commands/utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,10 @@ func sortConfigValues(data []api.ConfigValue) []api.ConfigValue {
156156

157157
func sortPtypes(ptypes []string) []string {
158158
sort.Slice(ptypes, func(i, j int) bool {
159-
if ptypes[i] == "web" {
159+
if ptypes[i] == api.PtypeWeb {
160160
return true
161161
}
162-
if ptypes[j] == "web" {
162+
if ptypes[j] == api.PtypeWeb {
163163
return false
164164
}
165165
return ptypes[i] < ptypes[j]
-13 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)