mirror of
https://github.com/icereed/paperless-gpt.git
synced 2025-03-13 05:08:01 -05:00
Update main.go
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
parent
b0737aab50
commit
3bcc05aaa8
1 changed files with 4 additions and 0 deletions
4
main.go
4
main.go
|
@ -387,7 +387,11 @@ func validateOrDefaultEnvVars() {
|
||||||
// Initialize token limit from environment variable
|
// Initialize token limit from environment variable
|
||||||
if limit := os.Getenv("TOKEN_LIMIT"); limit != "" {
|
if limit := os.Getenv("TOKEN_LIMIT"); limit != "" {
|
||||||
if parsed, err := strconv.Atoi(limit); err == nil {
|
if parsed, err := strconv.Atoi(limit); err == nil {
|
||||||
|
if parsed < 0 {
|
||||||
|
log.Fatalf("TOKEN_LIMIT must be non-negative, got: %d", parsed)
|
||||||
|
}
|
||||||
tokenLimit = parsed
|
tokenLimit = parsed
|
||||||
|
log.Infof("Using token limit: %d", tokenLimit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue