@@ -240,41 +240,6 @@ func serve(args []string) error {
240240 dc := sm .depClient
241241 appDB := & appsbuiltin.Repo {Path : * flRepoPath }
242242
243- var profilesvc profile.Service
244- {
245- profilesvc = profile .New (sm .profileDB )
246- }
247-
248- var blueprintsvc blueprint.Service
249- {
250- blueprintsvc = blueprint .New (bpDB )
251- }
252-
253- var usersvc user.Service
254- {
255- usersvc = user .New (userDB )
256- }
257-
258- var configsvc config.Service
259- {
260- configsvc = config .New (sm .configDB )
261- }
262-
263- var appsvc appstore.Service
264- {
265- appsvc = appstore .New (appDB )
266- }
267-
268- var devicesvc device.Service
269- {
270- devicesvc = device .New (devDB )
271- }
272-
273- var depsvc depapi.Service
274- {
275- depsvc = depapi .New (dc , sm .pubclient )
276- }
277-
278243 connectHandlers := connect .MakeHTTPHandlers (ctx , connectEndpoints , connectOpts ... )
279244 scepHandler := scep .ServiceHandler (ctx , sm .scepService , httpLogger )
280245 enrollHandlers := enroll .MakeHTTPHandlers (ctx , enroll .MakeServerEndpoints (sm .enrollService , sm .scepDepot ), httptransport .ServerErrorLogger (httpLogger ))
@@ -295,33 +260,40 @@ func serve(args []string) error {
295260 if * flAPIKey != "" {
296261 basicAuthEndpointMiddleware := basic .AuthMiddleware ("micromdm" , * flAPIKey , "micromdm" )
297262
263+ configsvc := config .New (sm .configDB )
298264 configEndpoints := config .MakeServerEndpoints (configsvc , basicAuthEndpointMiddleware )
299265 config .RegisterHTTPHandlers (r , configEndpoints , options ... )
300266
301267 apnsEndpoints := apns .MakeServerEndpoints (sm .pushService , basicAuthEndpointMiddleware )
302268 apns .RegisterHTTPHandlers (r , apnsEndpoints , options ... )
303269
270+ devicesvc := device .New (devDB )
304271 deviceEndpoints := device .MakeServerEndpoints (devicesvc , basicAuthEndpointMiddleware )
305272 device .RegisterHTTPHandlers (r , deviceEndpoints , options ... )
306273
274+ profilesvc := profile .New (sm .profileDB )
307275 profileEndpoints := profile .MakeServerEndpoints (profilesvc , basicAuthEndpointMiddleware )
308276 profile .RegisterHTTPHandlers (r , profileEndpoints , options ... )
309277
278+ blueprintsvc := blueprint .New (bpDB )
310279 blueprintEndpoints := blueprint .MakeServerEndpoints (blueprintsvc , basicAuthEndpointMiddleware )
311280 blueprint .RegisterHTTPHandlers (r , blueprintEndpoints , options ... )
312281
313282 blockEndpoints := block .MakeServerEndpoints (removeService , basicAuthEndpointMiddleware )
314283 block .RegisterHTTPHandlers (r , blockEndpoints , options ... )
315284
285+ usersvc := user .New (userDB )
316286 userEndpoints := user .MakeServerEndpoints (usersvc , basicAuthEndpointMiddleware )
317287 user .RegisterHTTPHandlers (r , userEndpoints , options ... )
318288
289+ appsvc := appstore .New (appDB )
319290 appEndpoints := appstore .MakeServerEndpoints (appsvc , basicAuthEndpointMiddleware )
320291 appstore .RegisterHTTPHandlers (r , appEndpoints , options ... )
321292
322293 commandEndpoints := command .MakeServerEndpoints (sm .commandService , basicAuthEndpointMiddleware )
323294 command .RegisterHTTPHandlers (r , commandEndpoints , options ... )
324295
296+ depsvc := depapi .New (dc , sm .pubclient )
325297 depEndpoints := depapi .MakeServerEndpoints (depsvc , basicAuthEndpointMiddleware )
326298 depapi .RegisterHTTPHandlers (r , depEndpoints , options ... )
327299
0 commit comments