Files
Strix/internal/app/app.go
T
eduard256 27117900eb Rewrite Strix from scratch as single binary
Complete architecture rewrite following go2rtc patterns:
- pkg/ for pure logic (camdb, tester, probe, generate)
- internal/ for application glue with Init() modules
- Single HTTP server on :4567 with all endpoints
- zerolog with password masking and memory ring buffer
- Environment-based config only (no YAML files)

API endpoints: /api/search, /api/streams, /api/test,
/api/probe, /api/generate, /api/health, /api/log

Dependencies: go2rtc v1.9.14, go-sqlite3, miekg/dns, zerolog
2026-03-25 10:38:46 +00:00

39 lines
561 B
Go

package app
import (
"os"
"runtime"
"time"
"github.com/rs/zerolog"
)
var Version string
var Logger zerolog.Logger
var Info = map[string]any{}
var StartTime = time.Now()
// DB is the shared SQLite database path
var DB string
func Init() {
initLogger()
Info["version"] = Version
Info["platform"] = runtime.GOARCH
Logger.Info().Str("version", Version).Str("platform", runtime.GOARCH).Msg("[app] start")
DB = Env("STRIX_DB_PATH", "cameras.db")
}
func Env(key, def string) string {
if v := os.Getenv(key); v != "" {
return v
}
return def
}