This commit is contained in:
Henrique Dias
2015-09-27 19:49:58 +01:00
parent 8f94827723
commit b1f13f1a4a
4 changed files with 24 additions and 14 deletions

View File

@@ -9,15 +9,17 @@ import (
// Config is the add-on configuration set on Caddyfile
type Config struct {
Styles string
Styles string
Args []string
Hugo bool
Args []string
Command string
Content string
}
// ParseCMS parses the configuration file
func ParseCMS(c *setup.Controller) (*Config, error) {
conf := &Config{Hugo: true}
conf := &Config{Hugo: true, Content: "content"}
for c.Next() {
for c.NextBlock() {
@@ -40,6 +42,13 @@ func ParseCMS(c *setup.Controller) (*Config, error) {
if err != nil {
return conf, err
}
case "content":
if !c.NextArg() {
return nil, c.ArgErr()
}
conf.Content = c.Val()
conf.Content = strings.TrimPrefix(conf.Content, "/")
conf.Content = strings.TrimSuffix(conf.Content, "/")
case "command":
if !c.NextArg() {
return nil, c.ArgErr()