Skip to content

Commit 05ff3dd

Browse files
authored
[cloud] Print message telling users how they can access their services (#761)
## Summary Print message telling user how they can access their services on devbox cloud. We could improve this in the future by trying to figure out what port the user is using for this particular service. (we can reuse port field that was already added for auto-port forwarding) Ideally this is not part of the CLI since it's only important for cloud, but this was quickest implementation. ## How was it tested? ```bash (devbox) ➜ devbox git:(main) ✗ DEVBOX_REGION=lax devbox services restart Service "nginx" stopped Service "nginx" started To access services on this vm use: Mike.local-<port>.svc.devbox.sh ```
1 parent 33c39a6 commit 05ff3dd

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

internal/services/services.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ func toggleServices(
101101
<-c
102102
}
103103

104+
if action == startService {
105+
return printProxyURL(w)
106+
}
107+
104108
return nil
105109
}
106110

@@ -147,3 +151,22 @@ func listenToAutoPortForwardingChangesOnRemote(
147151
},
148152
)
149153
}
154+
155+
func printProxyURL(w io.Writer) error {
156+
157+
if os.Getenv("DEVBOX_REGION") == "" {
158+
return nil
159+
}
160+
161+
hostname, err := os.Hostname()
162+
if err != nil {
163+
return errors.WithStack(err)
164+
}
165+
166+
color.New(color.FgHiGreen).Fprintf(
167+
w,
168+
"To access services on this vm use: %s-<port>.svc.devbox.sh\n",
169+
hostname,
170+
)
171+
return nil
172+
}

0 commit comments

Comments
 (0)