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!

@l4l

l4l commented Jul 29, 2026

Copy link
Copy Markdown
Author

2026-07-28T03:57:42.309299Z ERROR pgdog::net::stream: [127.0.0.1:47602] <-- FATAL: 28000 password for user "pgdog" and database "pgdog" is wrong, or the database does not exist

not sure if i broke it myself, perhaps some issue with ci credentials or missing waiting for startup time?

@l4l
l4l force-pushed the human-duration branch from be117a9 to 93a95b6 Compare July 30, 2026 20:53
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