mirror of
https://github.com/tenox7/wrp.git
synced 2024-11-22 10:31:21 +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 (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -82,9 +83,12 @@ func capture(url string, out http.ResponseWriter) {
|
|||||||
func main() {
|
func main() {
|
||||||
ctx, cancel = chromedp.NewContext(context.Background())
|
ctx, cancel = chromedp.NewContext(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
var addr string
|
||||||
|
flag.StringVar(&addr, "l", ":8080", "Listen address:port, default :8080")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
http.HandleFunc("/", pageServer)
|
http.HandleFunc("/", pageServer)
|
||||||
http.HandleFunc("/wrp.png", imgServer)
|
http.HandleFunc("/wrp.png", imgServer)
|
||||||
log.Printf("Starting http server on :8080\n")
|
log.Printf("Starting http server on %s\n", addr)
|
||||||
http.ListenAndServe(":8080", nil)
|
http.ListenAndServe(addr, nil)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user