diff --git a/.bra.toml b/.bra.toml index c2aa6eb72ed..eec1b4ca526 100644 --- a/.bra.toml +++ b/.bra.toml @@ -1,9 +1,12 @@ [run] -init_cmds = [["./bin/grafana", "web"]] +init_cmds = [ + ["make", "build"], + ["./bin/grafana", "web"] +] watch_all = true watch_dirs = [ "$WORKDIR/pkg", - "$WORKDIR/views", + "$WORKDIR/templates", "$WORKDIR/conf", ] watch_exts = [".go", ".ini"] diff --git a/grafana-pro b/grafana-pro deleted file mode 100755 index f1cd9a058e8..00000000000 Binary files a/grafana-pro and /dev/null differ diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 7b6dc722dae..b96834c600e 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -22,8 +22,8 @@ import ( var CmdWeb = cli.Command{ Name: "web", - Usage: "Start Grafana Pro web server", - Description: `Start Grafana Pro server`, + Usage: "grafana web", + Description: "Starts Grafana backend & web server", Action: runWeb, Flags: []cli.Flag{}, } @@ -33,14 +33,14 @@ func newMacaron() *macaron.Macaron { m.Use(middleware.Logger()) m.Use(macaron.Recovery()) - mapStatic(m, "public", "public") - mapStatic(m, "public/app", "app") - mapStatic(m, "public/img", "img") + mapStatic(m, "", "public") + mapStatic(m, "app", "app") + mapStatic(m, "img", "img") m.Use(session.Sessioner(setting.SessionOptions)) m.Use(macaron.Renderer(macaron.RenderOptions{ - Directory: path.Join(setting.StaticRootPath, "views"), + Directory: setting.TemplatesRootPath, IndentJSON: macaron.Env != macaron.PROD, Delims: macaron.Delims{Left: "[[", Right: "]]"}, })) diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index 7382d68fdd3..f000d2b4bde 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -52,6 +52,7 @@ var ( CertFile, KeyFile string RouterLogging bool StaticRootPath string + TemplatesRootPath string // Session settings. SessionOptions session.Options @@ -137,7 +138,8 @@ func NewConfigContext() { HttpPort = port } - StaticRootPath = Cfg.MustValue("server", "static_root_path", workDir) + StaticRootPath = Cfg.MustValue("server", "static_root_path", path.Join(workDir, "grafana/src")) + TemplatesRootPath = Cfg.MustValue("server", "templates_path", path.Join(workDir, "templates")) RouterLogging = Cfg.MustBool("server", "router_logging", false) // PhantomJS rendering diff --git a/views/404.html b/templates/404.html similarity index 100% rename from views/404.html rename to templates/404.html diff --git a/views/index.html b/templates/index.html similarity index 100% rename from views/index.html rename to templates/index.html