fixes and adjusting to a sliderule bump

This commit is contained in:
tjp 2023-11-14 15:47:13 -07:00
parent 1a3ec70d3f
commit de6853760c
3 changed files with 9 additions and 5 deletions

View File

@ -69,7 +69,7 @@ func addGopherStaticRoute(router *sr.Router, route RouteDirective) {
handlers := []sr.Handler{}
if route.Modifiers.Exec {
handlers = append(handlers, cgi.ExecGopherMaps(route.FsPath, route.URLPath, route.Modifiers.ExecCmd, settings))
handlers = append(handlers, cgi.GopherCGIDirectory(route.FsPath, route.URLPath, route.Modifiers.ExecCmd, settings))
}
handlers = append(handlers, fs.GopherFileHandler(route.FsPath, route.URLPath, settings))

View File

@ -12,7 +12,11 @@ var (
debug, info, warn, errlog logging.Logger
)
func BaseLogger(config *Configuration) logging.Logger {
return level.NewFilter(logging.Base(), level.Allow(config.LogLevel))
}
func Loggers(config *Configuration) (logging.Logger, logging.Logger, logging.Logger, logging.Logger) {
base := level.NewFilter(logging.Base(), level.Allow(config.LogLevel))
base := BaseLogger(config)
return level.Debug(base), level.Info(base), level.Warn(base), level.Error(base)
}

View File

@ -327,11 +327,11 @@ func validateRoute(serverType string, dir *RouteDirective) error {
return fmt.Errorf("%s servers don't support 'with autoatom'", serverType)
}
if dir.Modifiers.titanName != "" && (serverType != "gemini" || dir.Type != "static") {
return fmt.Errorf("titan modifier only allowed on gemini{static}")
return errors.New("titan modifier only allowed on gemini{static}")
}
if dir.Modifiers.ExecCmd != "" && !(dir.Type == "cgi" || (dir.Type == "static" && dir.Modifiers.Exec)) {
return fmt.Errorf("'cmd' modifier only valid on 'cgi' and 'static...with exec' directives")
return errors.New("'cmd' modifier only valid on 'cgi' and 'static...with exec' directives")
}
return nil
@ -400,7 +400,7 @@ func parseRouteDirective(line string) (RouteDirective, error) {
return dir, err
}
default:
return dir, fmt.Errorf("invalid '%s' directive", tag)
return dir, fmt.Errorf("invalid '%s' directive (unexpected '%s')", tag, word)
}
}
}