diff options
Diffstat (limited to 'cmd/reverseproxyd/main.go')
| -rw-r--r-- | cmd/reverseproxyd/main.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/cmd/reverseproxyd/main.go b/cmd/reverseproxyd/main.go new file mode 100644 index 0000000..964ef38 --- /dev/null +++ b/cmd/reverseproxyd/main.go @@ -0,0 +1,38 @@ +package main + +import ( + "flag" + "log" + "log/slog" + "net/http" + "net/http/httputil" + "net/url" + + "within.website/x/internal" +) + +var ( + bind = flag.String("bind", ":3004", "port to listen on") + proxyTo = flag.String("proxy-to", "http://localhost:5000", "where to reverse proxy to") +) + +func main() { + internal.HandleStartup() + + slog.Info("starting", + "bind", *bind, + "proxy-to", *proxyTo, + ) + + u, err := url.Parse(*proxyTo) + if err != nil { + log.Fatal(err) + } + + log.Fatal( + http.ListenAndServe( + *bind, + httputil.NewSingleHostReverseProxy(u), + ), + ) +} |
