Skip to content

Commit 0d4242c

Browse files
committed
Rename healthcheck route
1 parent bbc7fb1 commit 0d4242c

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A lightweight Go service that combines ping health checks with power management
44

55
## Features
66

7-
- **HTTP Health Endpoints**: `/ping` (monitored) and `/health` (healthcheck)
7+
- **HTTP Health Endpoints**: `/ping` (monitored) and `/healthcheck`
88
- **Activity Monitoring**: Tracks requests to `/ping` endpoint
99
- **Configurable Timeouts**: Environment-controlled inactivity periods
1010
- **GCP Integration**: Automatic instance suspension via GCP API service
@@ -24,14 +24,13 @@ docker run -p 8808:8808 -e INACTIVITY_TIMEOUT=90 lightswitch:latest
2424
| `PORT` | `8808` | HTTP server port |
2525
| `INACTIVITY_TIMEOUT` | `90` | Seconds of inactivity before shutdown |
2626
| `CHECK_INTERVAL` | `30` | Seconds between activity checks |
27-
| `LIBOPS_PROXY_URL` | - | GCP proxy URL for suspension |
2827
| `LIBOPS_KEEP_ONLINE` | - | Set to "yes" to disable auto-shutdown |
2928
| `LOG_LEVEL` | `INFO` | Logging level (DEBUG, INFO, WARN, ERROR) |
3029

3130
### Endpoints
3231

3332
- `GET /ping` - Returns "pong", activity is logged and monitored
34-
- `GET /health` - Returns "healthy", used for container healthchecks
33+
- `GET /healthcheck` - used for container healthchecks
3534

3635
## Integration
3736

@@ -43,7 +42,7 @@ This service is designed to work in tandem with [ppb (Proxy Power Button)](https
4342
- Receives incoming requests for dormant instances
4443
- Starts the GCE instance via GCP API
4544
- Proxies requests to the now-running backend
46-
45+
4746
2. **lightsout (Shutdown)**: Monitors activity and automatically shuts down instances during idle periods
4847
- Tracks activity via `/ping` endpoint calls
4948
- Monitors for configurable inactivity timeouts

main.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,6 @@ func pingHandler(w http.ResponseWriter, r *http.Request) {
363363
func healthHandler(w http.ResponseWriter, r *http.Request) {
364364
w.Header().Set("Content-Type", "text/plain")
365365
w.WriteHeader(http.StatusOK)
366-
if _, err := w.Write([]byte("healthy")); err != nil {
367-
slog.Error("Failed to write health response", "error", err)
368-
http.Error(w, "Failed to write response", http.StatusInternalServerError)
369-
return
370-
}
371366
}
372367

373368
func main() {
@@ -384,7 +379,7 @@ func main() {
384379

385380
// Setup HTTP handlers
386381
http.HandleFunc("/ping", pingHandler)
387-
http.HandleFunc("/health", healthHandler)
382+
http.HandleFunc("/healthcheck", healthHandler)
388383

389384
// Setup HTTP server
390385
server := &http.Server{

0 commit comments

Comments
 (0)