(ctx context.Context, url string)
| 196 | } |
| 197 | |
| 198 | func LoadConfigFromURL(ctx context.Context, url string) (*Config, error) { |
| 199 | req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil) |
| 200 | if err != nil { |
| 201 | return nil, errors.WithStack(err) |
| 202 | } |
| 203 | res, err := http.DefaultClient.Do(req) |
| 204 | if err != nil { |
| 205 | return nil, err |
| 206 | } |
| 207 | defer res.Body.Close() |
| 208 | |
| 209 | data, err := io.ReadAll(res.Body) |
| 210 | if err != nil { |
| 211 | return nil, errors.WithStack(err) |
| 212 | } |
| 213 | return loadBytes(data) |
| 214 | } |
| 215 | |
| 216 | func loadBytes(b []byte) (*Config, error) { |
| 217 | root, err := configfile.LoadBytes(b) |
no test coverage detected