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() }