(r *http.Request)
| 130 | } |
| 131 | |
| 132 | func inferServerURL(r *http.Request) string { |
| 133 | scheme := "https" |
| 134 | if r.TLS == nil { |
| 135 | if proto := r.Header.Get("X-Forwarded-Proto"); proto != "" { |
| 136 | scheme = proto |
| 137 | } else { |
| 138 | scheme = "http" |
| 139 | } |
| 140 | } |
| 141 | host := r.Host |
| 142 | if fwd := r.Header.Get("X-Forwarded-Host"); fwd != "" { |
| 143 | host = fwd |
| 144 | } |
| 145 | if host == "" { |
| 146 | return "" |
| 147 | } |
| 148 | return scheme + "://" + host |
| 149 | } |
| 150 | |
| 151 | func buildInstallCommand(serverURL, nodeID, token string) string { |
| 152 | return fmt.Sprintf("bash <(curl -fsSL %s) node --server=%s --node-id=%s --token=%s", |
no test coverage detected