mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
feat(api): add public status endpoints with version injection
Replace health_handler with status_handler providing public /status and /about endpoints. Add build-time version injection via ldflags in Makefile, and support --version/-v CLI flag. - Add /status endpoint returning runtime status, uptime, and version - Add /about endpoint with system metadata (name, description, repo) - Configure VERSION variable with git describe fallback - Update swagger docs and api.md for new public endpoints - Remove deprecated /api/status/test endpoint
This commit is contained in:
12
Makefile
12
Makefile
@@ -1,5 +1,9 @@
|
||||
.PHONY: all build swagger test clean dev
|
||||
|
||||
# Version injection - can be overridden via make build VERSION=v1.0.0
|
||||
VERSION ?= $(shell git describe --tags --always 2>/dev/null || echo "v0.1.0-dev")
|
||||
LDFLAGS := -X github.com/ez-api/ez-api/internal/api.Version=$(VERSION)
|
||||
|
||||
# Default target
|
||||
all: swagger build
|
||||
|
||||
@@ -10,12 +14,12 @@ swagger:
|
||||
|
||||
# Build the binary
|
||||
build: swagger
|
||||
@echo "Building ez-api..."
|
||||
go build -o ez-api ./cmd/server
|
||||
@echo "Building ez-api $(VERSION)..."
|
||||
go build -ldflags "$(LDFLAGS)" -o ez-api ./cmd/server
|
||||
|
||||
# Build without swagger regeneration (for quick iteration)
|
||||
build-fast:
|
||||
go build -o ez-api ./cmd/server
|
||||
go build -ldflags "$(LDFLAGS)" -o ez-api ./cmd/server
|
||||
|
||||
# Run tests
|
||||
test:
|
||||
@@ -28,7 +32,7 @@ clean:
|
||||
|
||||
# Run in development mode
|
||||
dev: swagger
|
||||
go run ./cmd/server
|
||||
go run -ldflags "$(LDFLAGS)" ./cmd/server
|
||||
|
||||
# Format code
|
||||
fmt:
|
||||
|
||||
Reference in New Issue
Block a user