Skip to content

build(runtime): embed the IANA tzdata in the binary - #49

Open
guisea wants to merge 1 commit into
Turbootzz:mainfrom
cybercinch:fix/embed-tzdata
Open

guisea wants to merge 1 commit into
Turbootzz:mainfrom
cybercinch:fix/embed-tzdata

Conversation

@guisea

@guisea guisea commented Sep 11, 2026

Copy link
Copy Markdown

Summary

  • Imports time/tzdata in cmd/api/main.go so time.LoadLocation and the TZ environment variable resolve on the runtime image, which is Alpine-based and ships no tzdata package.
  • Without this, TZ has no effect and log timestamps are stuck in UTC regardless of what the operator sets.
  • Adds about 450KB to the binary. Unset TZ still means UTC, same as before.
  • Documents TZ in .env.example.

Fixes #48

Test plan

  • go build ./... succeeds
  • Ran the binary with TZ=Pacific/Auckland set and confirmed log timestamps reflect the local offset instead of UTC

Summary by CodeRabbit

  • New Features

    • Added optional timezone configuration for log timestamps through the TZ environment variable.
    • Timezone values use IANA names and default to UTC when not specified.
  • Documentation

    • Documented the TZ setting and supported timezone format in the environment configuration example.

Import time/tzdata so time.LoadLocation and the TZ environment variable
resolve on the bare Alpine runtime image, which ships no tzdata package.
Unset TZ still means UTC. Adds ~450KB to the binary.
@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 09481729-50cf-4ba1-8213-eb6590e38237

📥 Commits

Reviewing files that changed from the base of the PR and between 17860c9 and e85423f.

📒 Files selected for processing (2)
  • .env.example
  • cmd/api/main.go

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The API binary now embeds the IANA timezone database. The environment example documents the optional TZ variable for log timestamps and its UTC default.

Changes

Timezone support

Layer / File(s) Summary
Embed timezone data and document TZ
.env.example, cmd/api/main.go
The binary embeds the IANA timezone database. The environment example documents TZ, supported zone names, and the UTC default.

Priority: ➖ Normal

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: turbootzz

Merge Risk: ⚪ Minimal · up to e8542

The API can use configured IANA time zones for log timestamps in the Alpine runtime while retaining UTC when TZ is unset. No actionable merge risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: embedding the IANA timezone database in the runtime binary.
Linked Issues check ✅ Passed For issue #48, cmd/api/main.go adds a blank import of time/tzdata. This embeds the IANA zoneinfo database and enables TZ values such as Pacific/Auckland on the Alpine runtime without a Docker …
Out of Scope Changes check ✅ Passed The reported changes are limited to importing time/tzdata in cmd/api/main.go and documenting the related TZ setting in .env.example. Both changes directly implement issue #48. No unrelated cha…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

Log timestamps stuck in UTC; TZ env has no effect (no tzdata in image)

1 participant