@@ -156,6 +156,7 @@ const (
156156var targetDir string
157157var emitLogEvents bool
158158var rewriteRuleFlags []string
159+ var listenAddr string
159160var rewriteRules []RewriteRule
160161
161162// RewriteRule holds a compiled regex and its replacement string
@@ -365,6 +366,8 @@ func init() {
365366 rootCmd .Flags ().BoolVar (& emitLogEvents , "emit-log-events" , false , "Enable emitting log events via OTLP" )
366367 rootCmd .Flags ().StringArrayVar (& rewriteRuleFlags , "compiled-path-rewrite-rule" , nil ,
367368 "Rewrite rule for compiled file paths (format: regex::replacement, can be specified multiple times)" )
369+ rootCmd .Flags ().StringVar (& listenAddr , "listen" , ":8080" ,
370+ "HTTP server listen address (format: [host]:port, e.g. :8080, 127.0.0.1:8080, 0.0.0.0:9000)" )
368371}
369372
370373func main () {
@@ -504,8 +507,8 @@ func run(cmd *cobra.Command, args []string) error {
504507 http .HandleFunc ("/v1/report" , handleReport )
505508 http .HandleFunc ("/v1/stats" , handleStats )
506509 go func () {
507- slog .Info ("Starting HTTP server on :8080" )
508- if err := http .ListenAndServe (":8080" , nil ); err != nil {
510+ slog .Info ("Starting HTTP server" , "listen" , listenAddr )
511+ if err := http .ListenAndServe (listenAddr , nil ); err != nil {
509512 slog .Error ("HTTP server error" , "error" , err )
510513 }
511514 }()
0 commit comments