Skip to content

internal/httpserver: add now template function for dynamic timestamps#205

Merged
efd6 merged 1 commit into
mainfrom
time
Jun 18, 2026
Merged

internal/httpserver: add now template function for dynamic timestamps#205
efd6 merged 1 commit into
mainfrom
time

Conversation

@efd6

@efd6 efd6 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Add a "now" template function to the HTTP mock server that returns the current UTC time formatted as RFC 3339. An optional Go duration string offsets the result, e.g. {{ now "-720h" }} for 30 days ago.

This allows integration test mock configs to produce timestamps relative to the current time instead of hardcoding dates that eventually age past time-windowed queries.

@efd6 efd6 self-assigned this Jun 17, 2026
@efd6 efd6 added enhancement New feature or request Team:Security-Service Integrations Team:Security-Service Integrations labels Jun 17, 2026
@efd6

efd6 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

@efd6 efd6 requested a review from a team June 17, 2026 06:39
Add a "now" template function to the HTTP mock server that returns
the current UTC time. An optional Go duration string offsets the
result, e.g. {{ (now "-720h").Format "2006-01-02T15:04:05Z07:00" }}
for 30 days ago.

This allows integration test mock configs to produce timestamps
relative to the current time instead of hardcoding dates that
eventually age past time-windowed queries.
@efd6

efd6 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

I've revised the approach; it was too tightly focused on the usecase that prompted it.

@elasticmachine

Copy link
Copy Markdown

💚 Build Succeeded

History

cc @efd6

Comment thread internal/httpserver/config.go

@kcreddy kcreddy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just minor clarification. LGTM otherwise.

@efd6 efd6 merged commit 588cc09 into main Jun 18, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Team:Security-Service Integrations Team:Security-Service Integrations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants