Extract the Central networking functionality from wild-cloud/api into a standalone service. Wild Central manages DNS (dnsmasq), gateway (HAProxy), firewall (nftables), VPN (WireGuard), TLS (certbot), security (CrowdSec), and DDNS — all the network appliance concerns. All Cloud-specific code (instances, clusters, nodes, apps, backups, operations, kubectl/talosctl tooling) has been removed. The API struct and route registration contain only Central endpoints. Tests updated to match the new API signature. Builds and all tests pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
76 lines
2.0 KiB
Makefile
76 lines
2.0 KiB
Makefile
.PHONY: help build dev test clean install lint fmt vet
|
|
|
|
BINARY_NAME=wild-central
|
|
BUILD_DIR=build
|
|
|
|
GOCMD=go
|
|
GOBUILD=$(GOCMD) build
|
|
GOCLEAN=$(GOCMD) clean
|
|
GOTEST=$(GOCMD) test
|
|
GOMOD=$(GOCMD) mod
|
|
GOFMT=$(GOCMD) fmt
|
|
GOVET=$(GOCMD) vet
|
|
|
|
LDFLAGS=-ldflags "-s -w"
|
|
|
|
help: ## Show this help message
|
|
@echo 'Usage: make [target]'
|
|
@echo ''
|
|
@echo 'Available targets:'
|
|
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
|
|
|
build: ## Build the daemon binary
|
|
@echo "Building $(BINARY_NAME)..."
|
|
@mkdir -p $(BUILD_DIR)
|
|
$(GOBUILD) $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME) .
|
|
|
|
dev: ## Run in development mode with live reloading
|
|
@if command -v air >/dev/null 2>&1; then \
|
|
echo "Starting $(BINARY_NAME) in development mode with live reloading (air)..."; \
|
|
air; \
|
|
else \
|
|
echo "air not found. Install it for live reloading: go install github.com/air-verse/air@latest"; \
|
|
echo "Starting $(BINARY_NAME) in development mode without live reloading..."; \
|
|
$(GOCMD) run .; \
|
|
fi
|
|
|
|
test: ## Run tests
|
|
@echo "Running tests..."
|
|
$(GOTEST) -v ./...
|
|
|
|
test-cover: ## Run tests with coverage
|
|
@echo "Running tests with coverage..."
|
|
$(GOTEST) -v -coverprofile=coverage.out ./...
|
|
$(GOCMD) tool cover -html=coverage.out -o coverage.html
|
|
@echo "Coverage report generated: coverage.html"
|
|
|
|
clean: ## Clean build artifacts
|
|
@echo "Cleaning..."
|
|
$(GOCLEAN)
|
|
@rm -rf $(BUILD_DIR)
|
|
@rm -f coverage.out coverage.html
|
|
|
|
install: build ## Install the binary
|
|
@echo "Installing $(BINARY_NAME)..."
|
|
@mkdir -p $$($(GOCMD) env GOPATH)/bin
|
|
@cp $(BUILD_DIR)/$(BINARY_NAME) $$($(GOCMD) env GOPATH)/bin/
|
|
|
|
deps: ## Download dependencies
|
|
@echo "Downloading dependencies..."
|
|
$(GOMOD) download
|
|
$(GOMOD) tidy
|
|
|
|
fmt: ## Format Go code
|
|
@echo "Formatting code..."
|
|
$(GOFMT) ./...
|
|
|
|
vet: ## Run go vet
|
|
@echo "Running go vet..."
|
|
$(GOVET) ./...
|
|
|
|
lint: fmt vet ## Run formatters and linters
|
|
|
|
check: lint test ## Run all checks (lint + test)
|
|
|
|
all: clean lint test build ## Clean, lint, test, and build
|