Some updates

This commit is contained in:
Henrique Dias committed 2017-07-12 15:28:35 +01:00
1 parent 476d20606d
commit 45b4ec5a43
5 files changed
+133 -36

No files matched your search

+12 -5
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)