feat: os-dependent default entrypoint
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
This commit is contained in:
@@ -132,6 +132,10 @@ func addRoute(res http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if route.Entrypoint == "" {
|
||||
route.Entrypoint = defaultEntrypoint
|
||||
}
|
||||
|
||||
route.ID = id.String()
|
||||
|
||||
created := funcAdd(route)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// +build !windows
|
||||
|
||||
package control
|
||||
|
||||
var defaultEntrypoint = "/bin/sh -c"
|
||||
@@ -0,0 +1,3 @@
|
||||
package control
|
||||
|
||||
var defaultEntrypoint = "cmd.exe /c"
|
||||
@@ -19,7 +19,7 @@ package model
|
||||
// Route contains the data needed to represent a Kapow! user route.
|
||||
type Route struct {
|
||||
// ID is the unique identifier of the Route.
|
||||
ID string `json:"id"`
|
||||
ID string `json:"id,omitempty"`
|
||||
|
||||
// Method is the HTTP method that will match this Route.
|
||||
Method string `json:"method"`
|
||||
@@ -33,7 +33,7 @@ type Route struct {
|
||||
//
|
||||
// This string will be split according to the shell parsing rules to
|
||||
// be passed as a list to exec.Command.
|
||||
Entrypoint string `json:"entrypoint"`
|
||||
Entrypoint string `json:"entrypoint,omitempty"`
|
||||
|
||||
// Command is the last argument to be passed to exec.Command when
|
||||
// executing the Entrypoint
|
||||
@@ -43,5 +43,5 @@ type Route struct {
|
||||
// It is an output field, its value is ignored as input.
|
||||
Index int `json:"index"`
|
||||
|
||||
Debug bool `json:"debug"`
|
||||
Debug bool `json:"debug,omitempty"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user