File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -39,21 +39,26 @@ type Client struct {
39
39
HTTPClient * http.Client
40
40
}
41
41
42
+ const defaultBaseURL = "https://build.sylabs.io"
43
+
42
44
// NewClient sets up a new build service client with the specified base URL and auth token.
43
45
func NewClient (cfg * Config ) (c * Client , err error ) {
44
46
if cfg == nil {
45
47
cfg = DefaultConfig
46
48
}
47
49
48
50
// Determine base URL
49
- bu := "https://build.sylabs.io"
51
+ bu := defaultBaseURL
50
52
if cfg .BaseURL != "" {
51
53
bu = cfg .BaseURL
52
54
}
53
55
baseURL , err := url .Parse (bu )
54
56
if err != nil {
55
57
return nil , err
56
58
}
59
+ if baseURL .Scheme != "http" && baseURL .Scheme != "https" {
60
+ return nil , fmt .Errorf ("unsupported protocol scheme %q" , baseURL .Scheme )
61
+ }
57
62
58
63
c = & Client {
59
64
BaseURL : baseURL ,
You can’t perform that action at this time.
0 commit comments