Skip to content

Commit 8e8896e

Browse files
committed
main: add option to disable RPC server
By default, goreman opens a port to the outside world that can accept commands, which could lead to potentially bad or unexpected consequences. (Also, my Mac asks me to approve the connection every single time I start goreman). Also add new-style build tags.
1 parent 9c23ea2 commit 8e8896e

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

_example/web.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build ignore
12
// +build ignore
23

34
package main

main.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ var procfile = flag.String("f", "Procfile", "proc file")
8080
// rpc port number.
8181
var port = flag.Uint("p", defaultPort(), "port")
8282

83+
var startRPCServer = flag.Bool("rpc-server", true, "Start an RPC server listening on "+defaultAddr())
84+
8385
// base directory
8486
var basedir = flag.String("basedir", "", "base directory")
8587

@@ -264,7 +266,9 @@ func start(ctx context.Context, sig <-chan os.Signal, cfg *config) error {
264266
}
265267
godotenv.Load()
266268
rpcChan := make(chan *rpcMessage, 10)
267-
go startServer(ctx, rpcChan, cfg.Port)
269+
if *startRPCServer {
270+
go startServer(ctx, rpcChan, cfg.Port)
271+
}
268272
procsErr := startProcs(sig, rpcChan, cfg.ExitOnError)
269273
return procsErr
270274
}

proc_posix.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !windows
12
// +build !windows
23

34
package main

0 commit comments

Comments
 (0)