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
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user