• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mendersoftware / iot-manager / 1057202363

01 Nov 2023 04:53AM UTC coverage: 87.876%. Remained the same
1057202363

Pull #219

gitlab-ci

web-flow
chore: bump github.com/aws/aws-sdk-go-v2/service/iotdataplane

Bumps [github.com/aws/aws-sdk-go-v2/service/iotdataplane](https://github.com/aws/aws-sdk-go-v2) from 1.16.5 to 1.18.0.
- [Release notes](https://github.com/aws/aws-sdk-go-v2/releases)
- [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/v1.18.0/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go-v2/compare/v1.16.5...v1.18.0)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go-v2/service/iotdataplane
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #219: chore: bump github.com/aws/aws-sdk-go-v2/service/iotdataplane from 1.16.5 to 1.18.0

3008 of 3423 relevant lines covered (87.88%)

10.43 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

84.0
/server/server.go
1
// Copyright 2022 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14

15
package server
16

17
import (
18
        "context"
19
        "net/http"
20
        "os"
21
        "os/signal"
22
        "time"
23

24
        "github.com/pkg/errors"
25
        "golang.org/x/sys/unix"
26

27
        "github.com/mendersoftware/go-lib-micro/config"
28
        "github.com/mendersoftware/go-lib-micro/log"
29

30
        api "github.com/mendersoftware/iot-manager/api/http"
31
        "github.com/mendersoftware/iot-manager/app"
32
        "github.com/mendersoftware/iot-manager/client/devauth"
33
        "github.com/mendersoftware/iot-manager/client/iotcore"
34
        "github.com/mendersoftware/iot-manager/client/iothub"
35
        "github.com/mendersoftware/iot-manager/client/workflows"
36
        dconfig "github.com/mendersoftware/iot-manager/config"
37
        "github.com/mendersoftware/iot-manager/store"
38
)
39

40
// InitAndRun initializes the server and runs it
41
func InitAndRun(conf config.Reader, dataStore store.DataStore) error {
1✔
42
        ctx := context.Background()
1✔
43
        httpClient := new(http.Client)
1✔
44
        wf := workflows.NewClient(
1✔
45
                conf.GetString(dconfig.SettingWorkflowsURL),
1✔
46
                workflows.NewOptions().SetClient(httpClient),
1✔
47
        )
1✔
48
        hub := iothub.NewClient(iothub.NewOptions().SetClient(httpClient))
1✔
49
        core := iotcore.NewClient()
1✔
50

1✔
51
        log.Setup(conf.GetBool(dconfig.SettingDebugLog))
1✔
52
        l := log.FromContext(ctx)
1✔
53

1✔
54
        da, err := devauth.NewClient(devauth.Config{
1✔
55
                Client:         httpClient,
1✔
56
                DevauthAddress: conf.GetString(dconfig.SettingDeviceauthURL),
1✔
57
        })
1✔
58
        if err != nil {
1✔
59
                return errors.Wrap(err, "failed to initialize devicauth client")
×
60
        }
×
61

62
        azureIotManagerApp := app.New(dataStore, wf, da).WithIoTHub(hub).WithIoTCore(core)
1✔
63

1✔
64
        router := api.NewRouter(azureIotManagerApp, api.NewConfig().SetClient(httpClient))
1✔
65

1✔
66
        var listen = conf.GetString(dconfig.SettingListen)
1✔
67
        srv := &http.Server{
1✔
68
                Addr:    listen,
1✔
69
                Handler: router,
1✔
70
        }
1✔
71

1✔
72
        l.Info("IoT Manager service starting up")
1✔
73
        l.Infof("listening on %s", listen)
1✔
74

1✔
75
        go func() {
2✔
76
                if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
1✔
77
                        l.Fatalf("listen: %s\n", err)
×
78
                }
×
79
        }()
80

81
        quit := make(chan os.Signal, 1)
1✔
82
        signal.Notify(quit, unix.SIGINT, unix.SIGTERM)
1✔
83
        <-quit
1✔
84

1✔
85
        l.Info("server shutdown")
1✔
86

1✔
87
        ctxWithTimeout, cancel := context.WithTimeout(ctx, 5*time.Second)
1✔
88
        defer cancel()
1✔
89
        if err := srv.Shutdown(ctxWithTimeout); err != nil {
1✔
90
                l.Fatal("error when shutting down the server ", err)
×
91
        }
×
92

93
        l.Info("server exiting")
×
94
        return nil
×
95
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc