did something
This commit is contained in:
@@ -28,9 +28,12 @@ func (h *InstanceHandler) Get(w http.ResponseWriter, r *http.Request) {
|
||||
})
|
||||
}
|
||||
|
||||
// sshHost extracts the hostname from InstanceURL. Falls back to the request
|
||||
// host when InstanceURL is unset (common in local development).
|
||||
// sshHost resolves the SSH hostname to display in clone URLs.
|
||||
// Priority: SSH_HOST env var > InstanceURL hostname > request Host header > localhost.
|
||||
func (h *InstanceHandler) sshHost(r *http.Request) string {
|
||||
if h.cfg.SSHHost != "" {
|
||||
return h.cfg.SSHHost
|
||||
}
|
||||
if h.cfg.InstanceURL != "" {
|
||||
if u, err := url.Parse(h.cfg.InstanceURL); err == nil && u.Hostname() != "" {
|
||||
return u.Hostname()
|
||||
@@ -41,5 +44,5 @@ func (h *InstanceHandler) sshHost(r *http.Request) string {
|
||||
if u, err := url.Parse("http://" + host); err == nil {
|
||||
return u.Hostname()
|
||||
}
|
||||
return host
|
||||
return "localhost"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user