chore: scaffold ingestion Go module

This commit is contained in:
Mathias Bergqvist
2026-04-17 20:16:59 +02:00
parent f76c150041
commit 6c485489bf
3 changed files with 54 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
// ingestion/cmd/server/main.go
package main
import (
"log/slog"
"net/http"
"os"
"github.com/mathiasbq/hyperguild/ingestion/internal/api"
)
func main() {
logger := slog.New(slog.NewJSONHandler(os.Stdout, nil))
brainDir := os.Getenv("INGEST_BRAIN_DIR")
if brainDir == "" {
brainDir = "../brain"
}
port := os.Getenv("INGEST_PORT")
if port == "" {
port = "3300"
}
h := api.NewHandler(brainDir, logger)
mux := http.NewServeMux()
mux.HandleFunc("/query", h.Query)
mux.HandleFunc("/write", h.Write)
addr := ":" + port
logger.Info("ingestion server starting", "addr", addr, "brain_dir", brainDir)
if err := http.ListenAndServe(addr, mux); err != nil {
logger.Error("server stopped", "err", err)
os.Exit(1)
}
}

11
ingestion/go.mod Normal file
View File

@@ -0,0 +1,11 @@
module github.com/mathiasbq/hyperguild/ingestion
go 1.26.1
require github.com/stretchr/testify v1.11.1
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

6
ingestion/go.sum Normal file
View File

@@ -0,0 +1,6 @@
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=