Skip to content

Add helper for safely parsing positive integer values from environment config #536

Description

@Chucks1093

Summary

Several config values — page size limits, webhook max count, rate limit thresholds — are read from environment variables as strings and must be positive integers. A shared config parser helper should centralize this coercion so invalid env values are caught at startup rather than at runtime.

Scope

  • Add parsePositiveInt(value: string | undefined, name: string, defaultValue: number): number helper
  • Returns the parsed integer if valid and positive
  • Returns defaultValue if the value is undefined
  • Throws a descriptive startup error if the value is defined but not a valid positive integer
  • Add unit tests for: valid integer, undefined uses default, zero throws, negative throws, non-numeric throws

Acceptance Criteria

  • Valid positive integer parses correctly
  • Undefined returns default value
  • Zero, negative, and non-numeric values throw a descriptive error
  • Error message includes the config variable name

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions