(baseURL, token string)
| 74 | } |
| 75 | |
| 76 | func initAPIClient(baseURL, token string) { |
| 77 | baseURLParsed, err := url.Parse(baseURL) |
| 78 | if err != nil { |
| 79 | fmt.Printf("Failed to parse base url %s: %s", baseURL, err) |
| 80 | os.Exit(1) |
| 81 | } |
| 82 | apiPath, err := url.JoinPath(baseURLParsed.Path, apiClient.DefaultBasePath) |
| 83 | if err != nil { |
| 84 | fmt.Printf("Failed to join base url path %s with %s: %s", baseURLParsed.Path, apiClient.DefaultBasePath, err) |
| 85 | os.Exit(1) |
| 86 | } |
| 87 | if debug { |
| 88 | os.Setenv("SWAGGER_DEBUG", "true") |
| 89 | } |
| 90 | transportCfg := apiClient.DefaultTransportConfig(). |
| 91 | WithHost(baseURLParsed.Host). |
| 92 | WithBasePath(apiPath). |
| 93 | WithSchemes([]string{baseURLParsed.Scheme}) |
| 94 | apiCli = apiClient.NewHTTPClientWithConfig(nil, transportCfg) |
| 95 | authToken = openapiRuntimeClient.BearerToken(token) |
| 96 | |
| 97 | joined, err := url.JoinPath(baseURL, apiClient.DefaultBasePath) |
| 98 | if err != nil { |
| 99 | fmt.Printf("Failed to join base url %s with %s: %s", baseURL, apiClient.DefaultBasePath, err) |
| 100 | os.Exit(1) |
| 101 | } |
| 102 | rawHTTPClient = &rawClient{ |
| 103 | BaseURL: joined, |
| 104 | Token: token, |
| 105 | HTTPClient: &http.Client{ |
| 106 | Timeout: 30 * time.Second, |
| 107 | }, |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | func initConfig() { |
| 112 | var err error |
no test coverage detected