- Add .gitignore: exclude compiled binaries, build artifacts, and Helm values files containing real secrets (authentik, prometheus) - Add all Kubernetes deployment manifests (deployment/) - Add services source code: ha-sync, device-inventory, games-console, paperclip, parts-inventory - Add Ansible orchestration: playbooks, roles, inventory, cloud-init - Add hardware specs, execution plans, scripts, HOMELAB.md - Add skills/homelab/SKILL.md + skills/install.sh to preserve Copilot skill - Remove previously-tracked inventory-cli binary from git index Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
38 lines
730 B
Go
38 lines
730 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"net/http"
|
|
"os"
|
|
|
|
"github.com/vandachevici/ha-sync/internal/db"
|
|
"github.com/vandachevici/ha-sync/internal/ui"
|
|
)
|
|
|
|
func main() {
|
|
dsn := os.Getenv("HA_SYNC_DB_DSN")
|
|
if dsn == "" {
|
|
fmt.Fprintln(os.Stderr, "HA_SYNC_DB_DSN environment variable is required")
|
|
os.Exit(1)
|
|
}
|
|
|
|
port := os.Getenv("HA_SYNC_UI_PORT")
|
|
if port == "" {
|
|
port = "8080"
|
|
}
|
|
|
|
sqlDB, err := db.Connect(dsn)
|
|
if err != nil {
|
|
log.Fatalf("failed to connect to database: %v", err)
|
|
}
|
|
defer sqlDB.Close()
|
|
|
|
handler := ui.NewServer(sqlDB).Handler()
|
|
|
|
addr := ":" + port
|
|
log.Printf("ha-sync-ui listening on %s", addr)
|
|
if err := http.ListenAndServe(addr, handler); err != nil {
|
|
log.Fatalf("server error: %v", err)
|
|
}
|
|
}
|