@@ -90,6 +90,10 @@ func main() {
90
90
log .Println ("calling GetValue(foo)" )
91
91
callGetValue (settingsClient )
92
92
93
+ // List all the settings.
94
+ log .Println ("calling GetAll()" )
95
+ callGetAll (settingsClient )
96
+
93
97
// Write settings to file.
94
98
log .Println ("calling Write()" )
95
99
callWrite (settingsClient )
@@ -100,11 +104,19 @@ func main() {
100
104
log .Println ("calling Init" )
101
105
instance := initInstance (client )
102
106
107
+ // We set up the proxy and then run the update to verify that the proxy settings are currently used
108
+ log .Println ("calling setProxy" )
109
+ callSetProxy (settingsClient )
110
+
103
111
// With a brand new instance, the first operation should always be updating
104
112
// the index.
105
113
log .Println ("calling UpdateIndex" )
106
114
callUpdateIndex (client , instance )
107
115
116
+ // And we run update again
117
+ log .Println ("calling UpdateIndex" )
118
+ callUpdateIndex (client , instance )
119
+
108
120
// Let's search for a platform (also known as 'core') called 'samd'.
109
121
log .Println ("calling PlatformSearch(samd)" )
110
122
callPlatformSearch (client , instance )
@@ -220,6 +232,31 @@ func callSetValue(client settings.SettingsClient) {
220
232
JsonData : `{"data": "` + dataDir + `", "downloads": "` + path .Join (dataDir , "staging" ) + `", "user": "` + path .Join (dataDir , "sketchbook" ) + `"}` ,
221
233
})
222
234
235
+ if err != nil {
236
+ log .Fatalf ("Error setting settings value: %s" , err )
237
+
238
+ }
239
+ }
240
+
241
+ func callSetProxy (client settings.SettingsClient ) {
242
+ _ , err := client .SetValue (context .Background (),
243
+ & settings.Value {
244
+ Key : "network.proxy" ,
245
+ JsonData : `"http://localhost:3128"` ,
246
+ })
247
+
248
+ if err != nil {
249
+ log .Fatalf ("Error setting settings value: %s" , err )
250
+ }
251
+ }
252
+
253
+ func callUnsetProxy (client settings.SettingsClient ) {
254
+ _ , err := client .SetValue (context .Background (),
255
+ & settings.Value {
256
+ Key : "network.proxy" ,
257
+ JsonData : `""` ,
258
+ })
259
+
223
260
if err != nil {
224
261
log .Fatalf ("Error setting settings value: %s" , err )
225
262
}
0 commit comments