Commit ea5cb0d0 by Torkel Ödegaard

fix(server side rendering): Fixed address used when rendering panel via…

fix(server side rendering): Fixed address used when rendering panel via phantomjs and using non default http_addr config, fixes #6660
parent 773fb5d1
# 4.0-stable (unrelased)
### Bugfixes
* **Server-side rendering**: Fixed address used when rendering panel via phantomjs and using non default http_addr config [#6660](https://github.com/grafana/grafana/issues/6660)
# 4.0-beta2 (2016-11-21) # 4.0-beta2 (2016-11-21)
### Bugfixes ### Bugfixes
......
...@@ -35,7 +35,12 @@ func RenderToPng(params *RenderOpts) (string, error) { ...@@ -35,7 +35,12 @@ func RenderToPng(params *RenderOpts) (string, error) {
executable = executable + ".exe" executable = executable + ".exe"
} }
url := fmt.Sprintf("%s://localhost:%s/%s", setting.Protocol, setting.HttpPort, params.Path) localAddress := "localhost"
if setting.HttpAddr != setting.DEFAULT_HTTP_ADDR {
localAddress = setting.HttpAddr
}
url := fmt.Sprintf("%s://%s:%s/%s", setting.Protocol, localAddress, setting.HttpPort, params.Path)
binPath, _ := filepath.Abs(filepath.Join(setting.PhantomDir, executable)) binPath, _ := filepath.Abs(filepath.Join(setting.PhantomDir, executable))
scriptPath, _ := filepath.Abs(filepath.Join(setting.PhantomDir, "render.js")) scriptPath, _ := filepath.Abs(filepath.Join(setting.PhantomDir, "render.js"))
......
...@@ -24,8 +24,9 @@ import ( ...@@ -24,8 +24,9 @@ import (
type Scheme string type Scheme string
const ( const (
HTTP Scheme = "http" HTTP Scheme = "http"
HTTPS Scheme = "https" HTTPS Scheme = "https"
DEFAULT_HTTP_ADDR string = "0.0.0.0"
) )
const ( const (
...@@ -474,7 +475,7 @@ func NewConfigContext(args *CommandLineArgs) error { ...@@ -474,7 +475,7 @@ func NewConfigContext(args *CommandLineArgs) error {
} }
Domain = server.Key("domain").MustString("localhost") Domain = server.Key("domain").MustString("localhost")
HttpAddr = server.Key("http_addr").MustString("0.0.0.0") HttpAddr = server.Key("http_addr").MustString(DEFAULT_HTTP_ADDR)
HttpPort = server.Key("http_port").MustString("3000") HttpPort = server.Key("http_port").MustString("3000")
RouterLogging = server.Key("router_logging").MustBool(false) RouterLogging = server.Key("router_logging").MustBool(false)
EnableGzip = server.Key("enable_gzip").MustBool(false) EnableGzip = server.Key("enable_gzip").MustBool(false)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment