summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortjp <tjp@ctrl-c.club>2023-11-14 15:47:13 -0700
committertjp <tjp@ctrl-c.club>2023-11-14 15:47:13 -0700
commitde6853760c155596f05b7d20bb53bbec0b3eb30e (patch)
tree9731993e758c1eced822c83d95fd0c6d407d6416
parent1a3ec70d3f0b7d62e570f3b85aa7e0e034a2cc7b (diff)
fixes and adjusting to a sliderule bump
-rw-r--r--gopher.go2
-rw-r--r--logging.go6
-rw-r--r--parse.go6
3 files changed, 9 insertions, 5 deletions
diff --git a/gopher.go b/gopher.go
index dcd2085..ecef9c0 100644
--- a/gopher.go
+++ b/gopher.go
@@ -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))
diff --git a/logging.go b/logging.go
index 9221b24..4986f5a 100644
--- a/logging.go
+++ b/logging.go
@@ -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)
}
diff --git a/parse.go b/parse.go
index f97cf83..89ce244 100644
--- a/parse.go
+++ b/parse.go
@@ -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)
}
}
}