feat: runtime manager

This commit is contained in:
Ilia Denisov
2026-04-28 20:39:18 +02:00
committed by GitHub
parent e0a99b346b
commit a7cee15115
289 changed files with 45660 additions and 2207 deletions
+18 -1
View File
@@ -4,6 +4,7 @@ import (
"errors"
"net/http"
"os"
"strings"
"galaxy/model/order"
"galaxy/model/report"
@@ -33,9 +34,25 @@ type executor struct {
cfg controller.Configurer
}
// ResolveStoragePath returns the engine storage path resolved from
// STORAGE_PATH (preferred, historical name) or GAME_STATE_PATH (canonical
// name written by Runtime Manager). It returns an error when neither
// variable is set; callers are expected to fail fast at startup.
func ResolveStoragePath() (string, error) {
if v := strings.TrimSpace(os.Getenv("STORAGE_PATH")); v != "" {
return v, nil
}
if v := strings.TrimSpace(os.Getenv("GAME_STATE_PATH")); v != "" {
return v, nil
}
return "", errors.New("storage path is not set: provide STORAGE_PATH or GAME_STATE_PATH")
}
func initConfig() controller.Configurer {
return func(p *controller.Param) {
p.StoragePath = os.Getenv("STORAGE_PATH")
// Validated once at startup by ResolveStoragePath; the error
// is dropped here to keep the Configurer signature simple.
p.StoragePath, _ = ResolveStoragePath()
}
}