@@ -3,6 +3,7 @@ package main
33import (
44 "context"
55 "errors"
6+ "fmt"
67 "github.com/wollomatic/socket-proxy/internal/config"
78 "log/slog"
89 "net"
@@ -21,7 +22,7 @@ const (
2122)
2223
2324var (
24- version = "0.1.0"
25+ version = "dev" // will be overwritten by build system
2526 socketProxy * httputil.ReverseProxy
2627 cfg * config.Config
2728)
@@ -55,8 +56,19 @@ func main() {
5556 } else {
5657 slog .Info ("watchdog disabled" )
5758 }
58- for method , regex := range config .AllowedRequests {
59- slog .Info ("configured allowed request" , "method" , method , "regex" , regex )
59+
60+ // print request allow list
61+ if cfg .LogJSON {
62+ for method , regex := range config .AllowedRequests {
63+ slog .Info ("configured allowed request" , "method" , method , "regex" , regex )
64+ }
65+ } else {
66+ // don't use slog here, as we want to print the regexes as they are
67+ // see https://github.com/wollomatic/socket-proxy/issues/11
68+ fmt .Printf ("Request allowlist:\n %-8s %s\n " , "Method" , "Regex" )
69+ for method , regex := range config .AllowedRequests {
70+ fmt .Printf (" %-8s %s\n " , method , regex )
71+ }
6072 }
6173
6274 // check if the socket is available
0 commit comments