update
parent
f95059d897
commit
34d72cbbc9
|
@ -1,7 +1,6 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/mholt/caddy/config/setup"
|
||||
|
@ -11,15 +10,13 @@ import (
|
|||
type Config struct {
|
||||
Styles string
|
||||
Args []string
|
||||
|
||||
Hugo bool
|
||||
Command string
|
||||
Content string
|
||||
}
|
||||
|
||||
// ParseCMS parses the configuration file
|
||||
func ParseCMS(c *setup.Controller) (*Config, error) {
|
||||
conf := &Config{Hugo: true, Content: "content"}
|
||||
conf := &Config{Content: "content"}
|
||||
|
||||
for c.Next() {
|
||||
for c.NextBlock() {
|
||||
|
@ -33,15 +30,6 @@ func ParseCMS(c *setup.Controller) (*Config, error) {
|
|||
conf.Styles = strings.TrimPrefix(conf.Styles, "/")
|
||||
// Add a beginning slash to make a
|
||||
conf.Styles = "/" + conf.Styles
|
||||
case "hugo":
|
||||
if !c.NextArg() {
|
||||
return nil, c.ArgErr()
|
||||
}
|
||||
var err error
|
||||
conf.Hugo, err = strconv.ParseBool(c.Val())
|
||||
if err != nil {
|
||||
return conf, err
|
||||
}
|
||||
case "content":
|
||||
if !c.NextArg() {
|
||||
return nil, c.ArgErr()
|
||||
|
|
|
@ -161,7 +161,7 @@ func ParseComponents(r *http.Request) []string {
|
|||
|
||||
// Run is used to run the static website generator
|
||||
func Run(c *config.Config) {
|
||||
if !c.Hugo {
|
||||
if c.Command != "" {
|
||||
out, err := exec.Command(c.Command, c.Args...).Output()
|
||||
if err != nil {
|
||||
log.Panic("Can't execute the commands defined on Caddyfile.")
|
||||
|
|
Loading…
Reference in New Issue