From 1d9584345e9a07624d22bac8d39562cc240c749d Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Sun, 27 Sep 2015 20:50:17 +0100 Subject: [PATCH] updates --- cms.go | 2 +- config/config.go | 4 ++-- utils/utils.go | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cms.go b/cms.go index 4fa085d3..53f92b2c 100644 --- a/cms.go +++ b/cms.go @@ -62,7 +62,7 @@ func (h CaddyCMS) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) // If the current page is only "/admin/", redirect to "/admin/browse/contents" if r.URL.Path == "/admin/" { - http.Redirect(w, r, "/admin/browse/content/", http.StatusTemporaryRedirect) + http.Redirect(w, r, "/admin/browse/"+h.Config.Content+"/", http.StatusTemporaryRedirect) return 0, nil } diff --git a/config/config.go b/config/config.go index 74d2e519..a7a8b37b 100644 --- a/config/config.go +++ b/config/config.go @@ -51,11 +51,11 @@ func ParseCMS(c *setup.Controller) (*Config, error) { } } - conf.parseFlags() + conf.parseArgs() return conf, nil } -func (c *Config) parseFlags() { +func (c *Config) parseArgs() { for index, element := range c.Args { c.Args[index] = strings.Replace(element, "\"", "", -1) } diff --git a/utils/utils.go b/utils/utils.go index f4ba18df..d4af6aca 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -2,6 +2,7 @@ package utils import ( "errors" + "fmt" "io" "log" "net/http" @@ -163,9 +164,9 @@ func ParseComponents(r *http.Request) []string { func Run(c *config.Config) { if c.Command != "" { out, err := exec.Command(c.Command, c.Args...).Output() + fmt.Print(string(out)) if err != nil { log.Panic("Can't execute the commands defined on Caddyfile.") - log.Print(out) } return