Skip to content

fix: update healthcheck to use server address and port individually#698

Merged
steveiliop56 merged 1 commit into
tinyauthapp:mainfrom
luizfelipefb:fix/healthcheck-server-port
Mar 8, 2026
Merged

fix: update healthcheck to use server address and port individually#698
steveiliop56 merged 1 commit into
tinyauthapp:mainfrom
luizfelipefb:fix/healthcheck-server-port

Conversation

@luizfelipefb
Copy link
Copy Markdown
Contributor

@luizfelipefb luizfelipefb commented Mar 8, 2026

Summary

healthcheckCmd does not return healthy when using only the server port variable

Problem

TINYAUTH_SERVER_PORT env variable is only used for creating the appUrl variable to check healthness when in combination with TINYAUTH_SERVER_ADDRESS, to have the healthcheck properly working we need to send the two variables

Solution

Allow to use any of the variables independent of the other, using the default values for both of them as previously was before

Summary by CodeRabbit

  • New Features
    • Health check configuration is now environment-driven via TINYAUTH_SERVER_ADDRESS and TINYAUTH_SERVER_PORT variables, with sensible defaults (127.0.0.1 and 3000). Command-line arguments can override these settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 8, 2026

📝 Walkthrough

Walkthrough

Replace hardcoded default app URL with environment-driven configuration. The healthcheck now reads TINYAUTH_SERVER_ADDRESS and TINYAUTH_SERVER_PORT environment variables, applying sensible defaults (127.0.0.1 and 3000) when unset, with optional CLI argument override.

Changes

Cohort / File(s) Summary
Healthcheck Configuration
cmd/tinyauth/healthcheck.go
Refactored app URL construction to use environment variables (TINYAUTH_SERVER_ADDRESS, TINYAUTH_SERVER_PORT) with fallback defaults instead of hardcoded values, maintaining optional argument override capability.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 The config hops free from its hardcoded nest,
Environment whispers what values are best,
Defaults keep safe when the signals run shy,
Flexibility blooms as the defaults apply! 🌱

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: updating the healthcheck to use server address and port independently instead of requiring both variables together.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmd/tinyauth/healthcheck.go`:
- Around line 31-41: The healthcheck builds appUrl using TINYAUTH_SERVER_ADDRESS
(srvAddr) which may be set to the non-routable bind address "0.0.0.0"; normalize
srvAddr before formatting appUrl by treating "0.0.0.0" (and optionally empty) as
"127.0.0.1" so the healthcheck connects to a routable loopback; update the logic
around srvAddr/srvPort used to build appUrl in healthcheck.go (the variables
srvAddr, srvPort, and appUrl) to perform this normalization.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7ef28af6-2a8d-4557-837b-594e3c101eb1

📥 Commits

Reviewing files that changed from the base of the PR and between 1d76cb8 and 32d0f06.

📒 Files selected for processing (1)
  • cmd/tinyauth/healthcheck.go

Comment thread cmd/tinyauth/healthcheck.go
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 8, 2026

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 15.22%. Comparing base (1d76cb8) to head (32d0f06).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
cmd/tinyauth/healthcheck.go 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #698      +/-   ##
==========================================
- Coverage   15.23%   15.22%   -0.01%     
==========================================
  Files          50       50              
  Lines        3696     3698       +2     
==========================================
  Hits          563      563              
- Misses       3076     3078       +2     
  Partials       57       57              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@steveiliop56 steveiliop56 merged commit f80be1c into tinyauthapp:main Mar 8, 2026
4 checks passed
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.

2 participants