From e6cf69863393b71771c56e098170be2123599b4c Mon Sep 17 00:00:00 2001 From: Alexander Kamyanskiy Date: Thu, 22 Feb 2018 23:41:36 +0300 Subject: [PATCH] nsq_to_http: use value passed by http flags --- apps/nsq_to_http/http.go | 2 -- apps/nsq_to_http/nsq_to_http.go | 4 +++ nsqadmin/bindata.go | 50 ++++++++++++++++----------------- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/apps/nsq_to_http/http.go b/apps/nsq_to_http/http.go index e56924066..3df18a92a 100644 --- a/apps/nsq_to_http/http.go +++ b/apps/nsq_to_http/http.go @@ -5,7 +5,6 @@ import ( "fmt" "net/http" - "github.com/nsqio/nsq/internal/http_api" "github.com/nsqio/nsq/internal/version" ) @@ -13,7 +12,6 @@ var httpclient *http.Client var userAgent string func init() { - httpclient = &http.Client{Transport: http_api.NewDeadlineTransport(*httpConnectTimeout, *httpRequestTimeout), Timeout: *httpRequestTimeout} userAgent = fmt.Sprintf("nsq_to_http v%s", version.Binary) } diff --git a/apps/nsq_to_http/nsq_to_http.go b/apps/nsq_to_http/nsq_to_http.go index e0cb9d936..acd4ea7b4 100644 --- a/apps/nsq_to_http/nsq_to_http.go +++ b/apps/nsq_to_http/nsq_to_http.go @@ -11,6 +11,7 @@ import ( "io/ioutil" "log" "math/rand" + "net/http" "net/url" "os" "os/signal" @@ -23,6 +24,7 @@ import ( "github.com/bitly/timer_metrics" "github.com/nsqio/go-nsq" "github.com/nsqio/nsq/internal/app" + "github.com/nsqio/nsq/internal/http_api" "github.com/nsqio/nsq/internal/version" ) @@ -171,6 +173,8 @@ func main() { flag.Var(&nsq.ConfigFlag{cfg}, "consumer-opt", "option to passthrough to nsq.Consumer (may be given multiple times, http://godoc.org/github.com/nsqio/go-nsq#Config)") flag.Parse() + httpclient = &http.Client{Transport: http_api.NewDeadlineTransport(*httpConnectTimeout, *httpRequestTimeout), Timeout: *httpRequestTimeout} + if *showVersion { fmt.Printf("nsq_to_http v%s\n", version.Binary) return diff --git a/nsqadmin/bindata.go b/nsqadmin/bindata.go index 87abb676f..c068d64e4 100644 --- a/nsqadmin/bindata.go +++ b/nsqadmin/bindata.go @@ -392,19 +392,19 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ - "base.css": baseCss, - "bootstrap.min.css": bootstrapMinCss, - "favicon.png": faviconPng, - "glyphicons-halflings-regular.eot": glyphiconsHalflingsRegularEot, - "glyphicons-halflings-regular.svg": glyphiconsHalflingsRegularSvg, - "glyphicons-halflings-regular.ttf": glyphiconsHalflingsRegularTtf, - "glyphicons-halflings-regular.woff": glyphiconsHalflingsRegularWoff, + "base.css": baseCss, + "bootstrap.min.css": bootstrapMinCss, + "favicon.png": faviconPng, + "glyphicons-halflings-regular.eot": glyphiconsHalflingsRegularEot, + "glyphicons-halflings-regular.svg": glyphiconsHalflingsRegularSvg, + "glyphicons-halflings-regular.ttf": glyphiconsHalflingsRegularTtf, + "glyphicons-halflings-regular.woff": glyphiconsHalflingsRegularWoff, "glyphicons-halflings-regular.woff2": glyphiconsHalflingsRegularWoff2, - "index.html": indexHtml, - "main.js": mainJs, - "main.js.map": mainJsMap, - "nsq_blue.png": nsq_bluePng, - "vendor.js": vendorJs, + "index.html": indexHtml, + "main.js": mainJs, + "main.js.map": mainJsMap, + "nsq_blue.png": nsq_bluePng, + "vendor.js": vendorJs, } // AssetDir returns the file names below a certain @@ -446,20 +446,21 @@ type bintree struct { Func func() (*asset, error) Children map[string]*bintree } + var _bintree = &bintree{nil, map[string]*bintree{ - "base.css": &bintree{baseCss, map[string]*bintree{}}, - "bootstrap.min.css": &bintree{bootstrapMinCss, map[string]*bintree{}}, - "favicon.png": &bintree{faviconPng, map[string]*bintree{}}, - "glyphicons-halflings-regular.eot": &bintree{glyphiconsHalflingsRegularEot, map[string]*bintree{}}, - "glyphicons-halflings-regular.svg": &bintree{glyphiconsHalflingsRegularSvg, map[string]*bintree{}}, - "glyphicons-halflings-regular.ttf": &bintree{glyphiconsHalflingsRegularTtf, map[string]*bintree{}}, - "glyphicons-halflings-regular.woff": &bintree{glyphiconsHalflingsRegularWoff, map[string]*bintree{}}, + "base.css": &bintree{baseCss, map[string]*bintree{}}, + "bootstrap.min.css": &bintree{bootstrapMinCss, map[string]*bintree{}}, + "favicon.png": &bintree{faviconPng, map[string]*bintree{}}, + "glyphicons-halflings-regular.eot": &bintree{glyphiconsHalflingsRegularEot, map[string]*bintree{}}, + "glyphicons-halflings-regular.svg": &bintree{glyphiconsHalflingsRegularSvg, map[string]*bintree{}}, + "glyphicons-halflings-regular.ttf": &bintree{glyphiconsHalflingsRegularTtf, map[string]*bintree{}}, + "glyphicons-halflings-regular.woff": &bintree{glyphiconsHalflingsRegularWoff, map[string]*bintree{}}, "glyphicons-halflings-regular.woff2": &bintree{glyphiconsHalflingsRegularWoff2, map[string]*bintree{}}, - "index.html": &bintree{indexHtml, map[string]*bintree{}}, - "main.js": &bintree{mainJs, map[string]*bintree{}}, - "main.js.map": &bintree{mainJsMap, map[string]*bintree{}}, - "nsq_blue.png": &bintree{nsq_bluePng, map[string]*bintree{}}, - "vendor.js": &bintree{vendorJs, map[string]*bintree{}}, + "index.html": &bintree{indexHtml, map[string]*bintree{}}, + "main.js": &bintree{mainJs, map[string]*bintree{}}, + "main.js.map": &bintree{mainJsMap, map[string]*bintree{}}, + "nsq_blue.png": &bintree{nsq_bluePng, map[string]*bintree{}}, + "vendor.js": &bintree{vendorJs, map[string]*bintree{}}, }} // RestoreAsset restores an asset under the given directory @@ -508,4 +509,3 @@ func _filePath(dir, name string) string { cannonicalName := strings.Replace(name, "\\", "/", -1) return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) } -