Some updates

Former-commit-id: 85b39b955a07c865e044c0f3153db47136ee4a2b [formerly 138bd8d44abb3b3515a2a2d4a5bded3f01ddb9de] [formerly 947626a88114a591b79b3b3022d1f89f3ad67f78 [formerly 45b4ec5a4392074cb3fda2204420be9135be71cf]]
Former-commit-id: 6f7c3b29f1c21cb26a5690d3b3e183571ebcb413 [formerly 0f604cd52712e918daaaa19b74c077af1e740bb2]
Former-commit-id: adc98f939069cf56180d1ffa10b19daf96696812
This commit is contained in:
Henrique Dias
2017-07-12 15:28:35 +01:00
parent 7a4e2a86e0
commit efdc61f791
5 changed files with 133 additions and 36 deletions

View File

@@ -18,7 +18,8 @@ import (
)
var (
errHugoNotFound = errors.New("It seems that tou don't have 'hugo' on your PATH")
errHugoNotFound = errors.New("It seems that tou don't have 'hugo' on your PATH")
errUnsupportedFileType = errors.New("The type of the provided file isn't supported for this action")
)
// setup configures a new FileManager middleware instance.
@@ -125,10 +126,6 @@ func parse(c *caddy.Controller) ([]*filemanager.FileManager, error) {
Public: filepath.Join(directory, "public"),
Args: []string{},
CleanPublic: true,
Commands: map[string][]string{
"before_publish": []string{},
"after_publish": []string{},
},
}
// Try to find the Hugo executable path.
@@ -141,6 +138,16 @@ func parse(c *caddy.Controller) ([]*filemanager.FileManager, error) {
return nil, err
}
err = m.RegisterEventType("before_publish")
if err != nil {
return nil, err
}
err = m.RegisterEventType("after_publish")
if err != nil {
return nil, err
}
m.SetBaseURL(admin)
m.SetPrefixURL(strings.TrimSuffix(caddyConf.Addr.Path, "/"))
configs = append(configs, m)