@@ -43,6 +43,7 @@ import (
43
43
paths "github.com/arduino/go-paths-helper"
44
44
"github.com/sirupsen/logrus"
45
45
"google.golang.org/grpc/codes"
46
+ "google.golang.org/grpc/metadata"
46
47
"google.golang.org/grpc/status"
47
48
)
48
49
@@ -63,6 +64,11 @@ func installTool(ctx context.Context, pm *packagemanager.PackageManager, tool *c
63
64
64
65
// Create a new Instance ready to be initialized, supporting directories are also created.
65
66
func (s * arduinoCoreServerImpl ) Create (ctx context.Context , req * rpc.CreateRequest ) (* rpc.CreateResponse , error ) {
67
+ var userAgent string
68
+ if md , ok := metadata .FromIncomingContext (ctx ); ok {
69
+ userAgent = strings .Join (md .Get ("user-agent" ), " " )
70
+ }
71
+
66
72
// Setup downloads directory
67
73
downloadsDir := s .settings .DownloadsDir ()
68
74
if downloadsDir .NotExist () {
@@ -87,7 +93,7 @@ func (s *arduinoCoreServerImpl) Create(ctx context.Context, req *rpc.CreateReque
87
93
if err != nil {
88
94
return nil , err
89
95
}
90
- inst , err := instances .Create (dataDir , packagesDir , userPackagesDir , downloadsDir , "" , config )
96
+ inst , err := instances .Create (dataDir , packagesDir , userPackagesDir , downloadsDir , userAgent , config )
91
97
if err != nil {
92
98
return nil , err
93
99
}
0 commit comments