load counter path from env
env
This commit is contained in:
parent
fb876226dd
commit
be89141c06
2 changed files with 15 additions and 2 deletions
8
main.go
8
main.go
|
|
@ -141,7 +141,13 @@ func main() {
|
|||
flag.Parse()
|
||||
|
||||
// Initialize request counter with 30-second snapshot interval
|
||||
counter, err := NewRequestCounter("request_counts.json", 30*time.Second)
|
||||
requestCountsPath := os.Getenv("REQUEST_COUNTS_PATH")
|
||||
if requestCountsPath == "" {
|
||||
err = errors.New("REQUEST_COUNTS_PATH environment variable must be set and non-empty")
|
||||
slog.Error("failed to initialize request counter", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
counter, err := NewRequestCounter(30 * time.Second)
|
||||
if err != nil {
|
||||
slog.Error("failed to initialize request counter", "error", err)
|
||||
os.Exit(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue