Skip to content

feat: support readable time values in config - #1273

Open
l4l wants to merge 1 commit into
pgdogdev:mainfrom
l4l:human-duration
Open

feat: support readable time values in config#1273
l4l wants to merge 1 commit into
pgdogdev:mainfrom
l4l:human-duration

Conversation

@l4l

@l4l l4l commented Jul 28, 2026

Copy link
Copy Markdown

Human-readable durations in config

Time settings now accept strings like "1h5m15s" alongside plain numbers, so ban_timeout = 300000 can be written as ban_timeout = "5m".
Motivation: make these value readable by mere mortals.
The spaces can be put anywhere, so " 1 h 2 m " also should work. The plain numbers still work and handled as before, this is an extension for params view.

New pgdog-config/src/duration.rs parses ms/s/m/h/d via serde(with=..) for all time fields. PGDOG_* env vars supports the same syntax.

Limitations:

  • only single symbol for easier parsing ("1s" works but not "1sec");
  • no support for admin commands like SET ban_timeout TO '5m';
  • only integers (i.e no "1.5s");

@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant