adds enabled flag to command runner itself

This commit is contained in:
Keagan McClelland 2020-09-22 19:37:56 -06:00
parent 8fc8f72103
commit dba8d53c9f
2 changed files with 5 additions and 1 deletions

View File

@ -51,7 +51,7 @@ func handle(fn handleFunc, prefix string, store *storage.Storage, server *settin
}
status, err := fn(w, r, &data{
Runner: &runner.Runner{Settings: settings},
Runner: &runner.Runner{Enabled: server.EnableExec, Settings: settings},
store: store,
settings: settings,
server: server,

View File

@ -13,11 +13,15 @@ import (
// Runner is a commands runner.
type Runner struct {
Enabled bool
*settings.Settings
}
// RunHook runs the hooks for the before and after event.
func (r *Runner) RunHook(fn func() error, evt, path, dst string, user *users.User) error {
if !r.Enabled {
return nil
}
path = user.FullPath(path)
dst = user.FullPath(dst)