updates
parent
34d72cbbc9
commit
1d9584345e
2
cms.go
2
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 the current page is only "/admin/", redirect to "/admin/browse/contents"
|
||||||
if r.URL.Path == "/admin/" {
|
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
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,11 +51,11 @@ func ParseCMS(c *setup.Controller) (*Config, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
conf.parseFlags()
|
conf.parseArgs()
|
||||||
return conf, nil
|
return conf, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) parseFlags() {
|
func (c *Config) parseArgs() {
|
||||||
for index, element := range c.Args {
|
for index, element := range c.Args {
|
||||||
c.Args[index] = strings.Replace(element, "\"", "", -1)
|
c.Args[index] = strings.Replace(element, "\"", "", -1)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -163,9 +164,9 @@ func ParseComponents(r *http.Request) []string {
|
||||||
func Run(c *config.Config) {
|
func Run(c *config.Config) {
|
||||||
if c.Command != "" {
|
if c.Command != "" {
|
||||||
out, err := exec.Command(c.Command, c.Args...).Output()
|
out, err := exec.Command(c.Command, c.Args...).Output()
|
||||||
|
fmt.Print(string(out))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Panic("Can't execute the commands defined on Caddyfile.")
|
log.Panic("Can't execute the commands defined on Caddyfile.")
|
||||||
log.Print(out)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue