feat: os-dependent default entrypoint

Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
This commit is contained in:
pancho horrillo
2020-12-23 18:44:11 +01:00
parent 0c16b5472f
commit e72c65c859
7 changed files with 23 additions and 8 deletions
+7 -3
View File
@@ -27,10 +27,14 @@ import (
// AddRoute will add a new route in kapow
func AddRoute(host, path, method, entrypoint, command string, w io.Writer) error {
url := host + "/routes"
body, _ := json.Marshal(map[string]string{
payload := map[string]string{
"method": method,
"url_pattern": path,
"entrypoint": entrypoint,
"command": command})
"command": command,
}
if entrypoint != "" {
payload["entrypoint"] = entrypoint
}
body, _ := json.Marshal(payload)
return http.Post(url, "application/json", bytes.NewReader(body), w)
}