feat: Initial

This commit is contained in:
Artёm Mishin committed 2025-04-25 11:20:31 +03:00
commit f0abca60db
26 files changed
+1112

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
package app
import (
"go.mrlokop.dev/universe/core/config"
"reflect"
)
type Info struct {
ServiceName string
Version string
BuildInfo *BuildInfo
}
type BuildInfo struct {
GitCommit string
BuildDate string
}
func provideAppInfo(
app Application,
cfg *config.UniverseConfig,
) *Info {
serviceInfo := cfg.ServiceInfo
if serviceInfo == nil {
serviceInfo = &config.ServiceInfo{}
// extract service name from app
serviceInfo.Name = extractServiceName(app)
}
return &Info{
ServiceName: serviceInfo.Name,
BuildInfo: &BuildInfo{
GitCommit: "",
BuildDate: "",
},
}
}
func extractServiceName(app Application) string {
appType := reflect.TypeOf(app)
if appType.Kind() == reflect.Ptr {
return appType.Elem().Name()
}
return appType.Name()
}