refactor: replace bash hacks with custom templates (#34)
This commit is contained in:
@ -1,5 +1,3 @@
|
||||
//lint:file-ignore ST1005 Ignore capitalized errors, they're generated
|
||||
|
||||
/*
|
||||
* Subset of Influx API covered by Influx CLI
|
||||
*
|
||||
@ -128,7 +126,7 @@ func (c *Configuration) AddDefaultHeader(key string, value string) {
|
||||
// URL formats template on a index using given variables
|
||||
func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) {
|
||||
if index < 0 || len(sc) <= index {
|
||||
return "", fmt.Errorf("Index %v out of range %v", index, len(sc)-1)
|
||||
return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1)
|
||||
}
|
||||
server := sc[index]
|
||||
url := server.URL
|
||||
@ -143,7 +141,7 @@ func (sc ServerConfigurations) URL(index int, variables map[string]string) (stri
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues)
|
||||
return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues)
|
||||
}
|
||||
url = strings.Replace(url, "{"+name+"}", value, -1)
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user