Skip to content

ClientName optional config, and do not auto-set it #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Config struct {
Disabled bool `toml:"disabled"` // default: false

WindowLength time.Duration `toml:"window_length"` // default: 1m
ClientName string `toml:"client_name"` // default: os.Args[0]
ClientName string `toml:"client_name"` // default: ""
PrefixKey string `toml:"prefix_key"` // default: "httprate"

// OnError lets you subscribe to all runtime Redis errors. Useful for logging/debugging.
Expand Down
5 changes: 0 additions & 5 deletions httprateredis.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package httprateredis
import (
"context"
"fmt"
"os"
"path/filepath"
"strconv"
"sync/atomic"
"time"
Expand Down Expand Up @@ -38,9 +36,6 @@ func NewCounter(cfg *Config) *redisCounter {
if cfg.Port < 1 {
cfg.Port = 6379
}
if cfg.ClientName == "" {
cfg.ClientName = filepath.Base(os.Args[0])
}
if cfg.PrefixKey == "" {
cfg.PrefixKey = "httprate"
}
Expand Down
Loading