"ntfy tier" CLI command

This commit is contained in:
binwiederhier 2023-02-07 12:02:25 -05:00
parent e3b39f670f
commit a32e8abc12
8 changed files with 140 additions and 40 deletions

View file

@ -24,7 +24,9 @@ func logv(v *visitor) *log.Event {
// logr creates a new log event with HTTP request and visitor fields
func logvr(v *visitor, r *http.Request) *log.Event {
return logv(v).Fields(httpContext(r))
return logv(v).
Fields(httpContext(r)).
Fields(requestLimiterFields(v.RequestLimiter()))
}
// logvrm creates a new log event with HTTP request, visitor fields and message fields

View file

@ -37,7 +37,7 @@ import (
- HIGH Rate limiting: Sensitive endpoints (account/login/change-password/...)
- HIGH Account limit creation triggers when account is taken!
- HIGH Docs
- HIGH CLI "ntfy tier [add|list|delete]"
- HIGH make request limit independent of message limit again
- HIGH Self-review
- MEDIUM: Test for expiring messages after reservation removal
- MEDIUM: Test new token endpoints & never-expiring token
@ -235,8 +235,8 @@ func (s *Server) Run() error {
}
log.Info("Listening on%s, ntfy %s, log level is %s", listenStr, s.config.Version, log.CurrentLevel().String())
if log.IsFile() {
fmt.Fprintf(os.Stderr, "Listening on%s, ntfy %s, log file is %s\n", listenStr, s.config.Version, log.File())
fmt.Fprintln(os.Stderr, "No more output is expected.")
fmt.Fprintf(os.Stderr, "Listening on%s, ntfy %s\n", listenStr, s.config.Version)
fmt.Fprintf(os.Stderr, "Logs are written to %s\n", log.File())
}
mux := http.NewServeMux()
mux.HandleFunc("/", s.handle)