Skip to content

Commit

Permalink
Accept command-line flags for wait timeout and whether to return unfi…
Browse files Browse the repository at this point in the history
…nished pages
  • Loading branch information
sqs committed Oct 31, 2013
1 parent 2e14bd9 commit d27b2c1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cmd/static-reverse-proxy/static_reverse_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (

var bind = flag.String("http", ":13000", "HTTP bind address")
var targetURL = flag.String("target", "http://localhost:3000", "base URL of target")
var waitTimeout = flag.Duration("wait", time.Second*3, "timeout for pages to set window.$renderStaticReady")
var returnUnfinishedPages = flag.Bool("unfinished", false, "return unfinished pages at wait timeout (instead of erroring)")
var redirectPrefixesStr = flag.String("redirect-prefixes", "/static,/api,/favicon.ico", "comma-separated list of path prefixes to redirect to the target (not proxy and render)")

func main() {
Expand Down Expand Up @@ -48,9 +50,10 @@ func main() {
}

staticRenderer := &webloop.StaticRenderer{
TargetBaseURL: *targetURL,
WaitTimeout: time.Second * 3,
Log: log,
TargetBaseURL: *targetURL,
WaitTimeout: *waitTimeout,
ReturnUnfinishedPages: *returnUnfinishedPages,
Log: log,
}
h := func(w http.ResponseWriter, r *http.Request) {
for _, rp := range redirectPrefixes {
Expand Down

0 comments on commit d27b2c1

Please sign in to comment.