mirror of
https://github.com/tenox7/wrp.git
synced 2024-11-25 13:30:51 +00:00
add flags
This commit is contained in:
parent
e869291f8e
commit
0680b4a72e
8
wrp.go
8
wrp.go
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
@ -82,9 +83,12 @@ func capture(url string, out http.ResponseWriter) {
|
||||
func main() {
|
||||
ctx, cancel = chromedp.NewContext(context.Background())
|
||||
defer cancel()
|
||||
var addr string
|
||||
flag.StringVar(&addr, "l", ":8080", "Listen address:port, default :8080")
|
||||
flag.Parse()
|
||||
|
||||
http.HandleFunc("/", pageServer)
|
||||
http.HandleFunc("/wrp.png", imgServer)
|
||||
log.Printf("Starting http server on :8080\n")
|
||||
http.ListenAndServe(":8080", nil)
|
||||
log.Printf("Starting http server on %s\n", addr)
|
||||
http.ListenAndServe(addr, nil)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user