We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6f142a3 commit 53f1d78Copy full SHA for 53f1d78
pkg/inject/download_urls.go
@@ -2,10 +2,12 @@ package inject
2
3
import (
4
"net/url"
5
+ "strings"
6
)
7
8
const AmdUrl = "devpod-linux-amd64"
9
const ArmUrl = "devpod-linux-arm64"
10
+const BinNamePlaceholder = "${BIN_NAME}"
11
12
type DownloadURLs struct {
13
Base string
@@ -14,8 +16,17 @@ type DownloadURLs struct {
14
16
}
15
17
18
func NewDownloadURLs(baseUrl string) *DownloadURLs {
- amdUrl, _ := url.JoinPath(baseUrl, AmdUrl)
- armUrl, _ := url.JoinPath(baseUrl, ArmUrl)
19
+ var amdUrl, armUrl string
20
+
21
+ // replace ${BIN_NAME} with binary name
22
+ if strings.Contains(baseUrl, BinNamePlaceholder) {
23
+ baseUrl = strings.TrimSuffix(baseUrl, "/")
24
+ amdUrl = strings.Replace(baseUrl, BinNamePlaceholder, AmdUrl, 1)
25
+ armUrl = strings.Replace(baseUrl, BinNamePlaceholder, ArmUrl, 1)
26
+ } else {
27
+ amdUrl, _ = url.JoinPath(baseUrl, AmdUrl)
28
+ armUrl, _ = url.JoinPath(baseUrl, ArmUrl)
29
+ }
30
31
return &DownloadURLs{
32
Base: baseUrl,
0 commit comments