fix(system.GetInfo) check if context is nil

This commit is contained in:
shatoboar
2022-05-20 17:12:29 +02:00
parent 252f92c029
commit c349fc8a4e
+2
View File
@@ -49,12 +49,14 @@ func GetInfo(ctx context.Context) *Info {
gio.Hostname, _ = os.Hostname() gio.Hostname, _ = os.Hostname()
gio.WiretrusteeVersion = WiretrusteeVersion() gio.WiretrusteeVersion = WiretrusteeVersion()
if ctx != nil {
metadata, ok := metadata.FromIncomingContext(ctx) metadata, ok := metadata.FromIncomingContext(ctx)
if ok { if ok {
gio.Caller = metadata["caller"][0] gio.Caller = metadata["caller"][0]
gio.CallerVersion = metadata["callerVersion"][0] gio.CallerVersion = metadata["callerVersion"][0]
} }
}
return gio return gio
} }