From 17dd869ff3a3e31396bdd33df2f35e1793c3440d Mon Sep 17 00:00:00 2001 From: Jimmy Date: Fri, 17 Sep 2021 22:14:03 +1200 Subject: [PATCH] Add JAR env. Add env debug vode --- src/main.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main.go b/src/main.go index 08a195d..46f4425 100644 --- a/src/main.go +++ b/src/main.go @@ -10,15 +10,17 @@ import ( "os/signal" "strings" "syscall" + "log" "github.com/creack/pty" ) func main() { + log.Println("Starting Server") sigs := make(chan os.Signal, 1) signal.Notify(sigs, syscall.SIGTERM) - var minram, maxram, args, stop string + var minram, maxram, args, stop, jar string for _, e := range os.Environ() { pair := strings.SplitN(e, "=", 2) switch pair[0] { @@ -30,13 +32,18 @@ func main() { args = pair[1] case "STOP": stop = pair[1] + case "JAR": + jar = pair[1] } + } + log.Printf("Ram: Min: %s Max: %s Stop: %s Jar: %s\n\rArgs: %s", minram, maxram, stop, jar, args) + var cmd *exec.Cmd if args == "" { - cmd = exec.Command("java", minram, maxram, "-jar", "server.jar") + cmd = exec.Command("java", minram, maxram, "-jar", jar) } else { - cmd = exec.Command("java", minram, maxram, args, "-jar", "server.jar") + cmd = exec.Command("java", minram, maxram, args, "-jar", jar) } cmd.Dir = "/server"