fix: allow just binary execution
This commit is contained in:
parent
adf47e4810
commit
9c735ccf64
|
@ -13,8 +13,8 @@ type Config struct {
|
|||
}
|
||||
type ConfigScript struct {
|
||||
Environment string `yaml:"environment"`
|
||||
BinaryPath string `yaml:"binary"`
|
||||
ScriptPath string `yaml:"script"`
|
||||
Command string `yaml:"command"`
|
||||
Arguments string `yaml:"args"`
|
||||
}
|
||||
|
||||
func LoadConfig(path string) (*Config, error) {
|
||||
|
|
7
main.go
7
main.go
|
@ -27,6 +27,7 @@ func main() {
|
|||
if err != nil {
|
||||
log.Fatalf("Error loading config: %v", err)
|
||||
}
|
||||
log.Println("GOOO")
|
||||
http.HandleFunc("/", handlePayload(cfg.Secret, cfg.Projects))
|
||||
http.ListenAndServe(fmt.Sprintf(":%d", cfg.Port), nil)
|
||||
}
|
||||
|
@ -80,15 +81,15 @@ func handlePayload(secret string, projects map[string][]config.ConfigScript) fun
|
|||
}
|
||||
|
||||
go func() {
|
||||
if err := execute(scr.BinaryPath, scr.ScriptPath); err != nil {
|
||||
if err := execute(scr.Command, scr.Arguments); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
}()
|
||||
})
|
||||
}
|
||||
|
||||
func execute(binaryPath, scriptPath string) error {
|
||||
cmd := exec.Command(binaryPath, scriptPath)
|
||||
func execute(command, args string) error {
|
||||
cmd := exec.Command(command, args)
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
|
|
Loading…
Reference in New Issue