Add timezone information to the available fields
My use case also uses the timezone information (available on ipinfo.io) but was not yet available in this self hosted soltution. This PR downloads the City geo database and uses that to return a "best guess" timezone for the users IP.
π Walkthrough
Walkthrough
Adds timezone support (GeoLite2-City), exposes /timezone and timezone in /json, updates nginx real IP handling, extends Docker build to fetch City DB, and adds Kubernetes manifests plus a GitHub Actions multi-arch build workflow.
Changes
Core Feature - Timezone Detection & API
| Layer / File(s) | Summary |
|---|---|
Timezone features nginx/conf.d/geoip2.conf, nginx/conf.d/ipinfo.conf, Dockerfile, README.md |
Adds GeoLite2-City support in the Docker build, maps geoip2 time_zone to $ip_time_zone, adds /timezone endpoint, and includes timezone in /json responses; README updated with examples. |
Infrastructure - Kubernetes Manifests
| Layer / File(s) | Summary |
|---|---|
Kubernetes manifests k8s/deployment.yaml, k8s/ingress.yaml, k8s/service.yaml |
Adds deployment (eva-whoami, 2 replicas), Ingress with TLS/cert-manager for whoami.on-eva.io, and LoadBalancer Service with Azure annotations. |
Documentation & CI/CD
| Layer / File(s) | Summary |
|---|---|
Docs and CI README.md, .github/workflows/build.yml |
README documents new timezone endpoint and examples; new GitHub Actions workflow builds and pushes multi-arch Docker images with MAXMIND_LICENSE_KEY build-arg. |
Sequence Diagram(s)
sequenceDiagram
participant Client
participant nginx as nginx + geoip2
participant GeoLite2 as GeoLite2-City DB
participant Response
Client->>nginx: GET /json (client IP)
nginx->>GeoLite2: geoip2 lookup of client IP -> time_zone
GeoLite2-->>nginx: return timezone data
nginx->>nginx: set $ip_time_zone from lookup
nginx-->>Response: JSON {ip, country, as, timezone}
Response-->>Client: HTTP response with timezone field
Estimated code review effort
π― 3 (Moderate) | β±οΈ ~22 minutes
π₯ Pre-merge checks | β 5
β Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description check | β Passed | The description is directly related to the changeset, explaining the motivation and implementation approach for adding timezone data using the City geo database. |
| Docstring Coverage | β Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check | β Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | β Passed | Check skipped because no linked issues were found for this pull request. |
| Title check | β Passed | The title 'Add timezone information to the available fields' directly and clearly describes the main objective of the changeset. |
βοΈ Tip: You can configure your own custom pre-merge checks in the settings.
β¨ Finishing Touches
π§ͺ Generate unit tests (beta)
- [ ] Create PR with unit tests
[!TIP]
π¬ Introducing Slack Agent: The best way for teams to turn conversations into code.
Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
- Generate code and open pull requests
- Plan features and break down work
- Investigate incidents and troubleshoot customer tickets together
- Automate recurring tasks and respond to alerts with triggers
- Summarize progress and report instantly
Built for teams:
- Shared memory across your entire orgβno repeating context
- Per-thread sandboxes to safely plan and execute work
- Governance built-inβscoped access, auditability, and budget controls
One agent for your entire SDLC. Right inside Slack.
π Get started
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.
Comment @coderabbitai help to get the list of available commands and usage tips.
@PeterDaveHello removed the comments, newlines and added a bit of documentation on the timezone field
Code Review Summary
Status: 3 New Issues Found (15 existing) | Recommendation: Address before merge β significant scope contamination
Overview
| Severity | Count |
|---|---|
| CRITICAL | 0 |
| WARNING | 2 |
| SUGGESTION | 1 |
Issue Details (click to expand)
WARNING
| File | Line | Issue |
|---|---|---|
nginx/conf.d/realip.conf |
1 | Switching trusted header from X-Real-IP to X-Forwarded-For with real_ip_recursive on is a breaking change unrelated to the timezone feature; allows IP spoofing via XFF from any RFC1918 source. |
k8s/deployment.yaml |
26 | Image reference has no explicit tag (defaults to :latest) combined with imagePullPolicy: Always β rollouts become non-deterministic and rollback is impossible. |
SUGGESTION
| File | Line | Issue |
|---|---|---|
nginx/conf.d/realip.conf |
5 | Missing trailing newline at end of file. |
Other Observations (scope concerns, not in diff)
The stated PR scope is "add timezone information" but the diff also contains a large amount of fork-specific deployment configuration that does not belong in the upstream repository:
| File | Concern |
|---|---|
.github/workflows/build.yml |
Pushes images to a private Azure registry (cratecache.azurecr.io/new-black/eva-whoami) using fork-specific secrets (ACR_USERNAME, ACR_PASSWORD). Not useful upstream. |
k8s/deployment.yaml |
References private image, namespace platform-tools, and app name eva-whoami. |
k8s/ingress.yaml |
Hard-codes private hostname whoami.on-eva.io and a private cluster issuer. |
k8s/service.yaml |
Hard-codes a private nodePort 31514 and an Azure-specific load-balancer resource group annotation. |
nginx/conf.d/realip.conf |
The header-trust change is unrelated to the timezone feature. |
Recommend stripping these out so the PR contains only the changes needed for the /timezone endpoint: Dockerfile (City db), nginx/conf.d/geoip2.conf, nginx/conf.d/ipinfo.conf, and README.md.
Also note (informational, no diff line to comment on): when MaxMind cannot resolve a city for an IP (private ranges, unknown IPs), $ip_time_zone will be empty and /timezone returns just \n while /json returns "timezone":"". This is consistent with how other endpoints behave today, but worth documenting in the README so users aren't surprised.
Files Reviewed (9 files)
.github/workflows/build.ymlβ out of scope; existing comments cover concernsDockerfileβ City db steps look correct (existing comment on line 26)README.mdβ timezone docs added; existing comment on line 66k8s/deployment.yamlβ out of scope; 1 new issue (line 26 image tag)k8s/ingress.yamlβ out of scope; existing comment on line 7k8s/service.yamlβ out of scopenginx/conf.d/geoip2.confβ City db block added; existing comments cover stylenginx/conf.d/ipinfo.confβ/timezoneendpoint and JSON field look correctnginx/conf.d/realip.confβ 2 new issues (header trust change, missing newline)
Fix these issues in Kilo Cloud
Reviewed by claude-opus-4.7 Β· 242,091 tokens
@codex review