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

mendersoftware / mender-server / 1495380963

14 Oct 2024 03:35PM UTC coverage: 70.373% (-2.5%) from 72.904%
1495380963

Pull #101

gitlab-ci

mineralsfree
feat: tenant list added

Ticket: MEN-7568
Changelog: None

Signed-off-by: Mikita Pilinka <mikita.pilinka@northern.tech>
Pull Request #101: feat: tenant list added

4406 of 6391 branches covered (68.94%)

Branch coverage included in aggregate %.

88 of 183 new or added lines in 10 files covered. (48.09%)

2623 existing lines in 65 files now uncovered.

36673 of 51982 relevant lines covered (70.55%)

31.07 hits per line

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

0.0
/backend/services/create-artifact-worker/config/config.go
1
// Copyright 2023 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
package config
15

16
import (
17
        "fmt"
18
        "net/url"
19
        "path/filepath"
20

21
        "github.com/pkg/errors"
22
        "github.com/spf13/viper"
23
)
24

25
const (
26
        //translate to env vars: CREATE_ARTIFACT_<CAPITALIZED>
27
        CfgSkipVerify     = "skipverify"
28
        CfgVerbose        = "verbose"
29
        CfgWorkDir        = "workdir"
30
        CfgDeploymentsUrl = "deployments_url"
31
)
32

UNCOV
33
func Init() {
×
UNCOV
34
        viper.SetEnvPrefix("CREATE_ARTIFACT")
×
UNCOV
35
        viper.AutomaticEnv()
×
UNCOV
36

×
UNCOV
37
        viper.SetDefault(CfgSkipVerify, false)
×
UNCOV
38
        viper.SetDefault(CfgVerbose, false)
×
UNCOV
39
        viper.SetDefault(CfgWorkDir, "/var")
×
UNCOV
40
        viper.SetDefault(CfgDeploymentsUrl, "http://mender-deployments:8080")
×
UNCOV
41
}
×
42

43
func ValidUrl(s string) error {
×
44
        u, err := url.Parse(s)
×
45
        if err != nil {
×
46
                return err
×
47
        }
×
48

49
        if u.Host == "" || u.Scheme == "" {
×
50
                return errors.New("url needs scheme and host at a minimum")
×
51
        }
×
52

53
        return nil
×
54
}
55

UNCOV
56
func ValidAbsPath(s string) error {
×
UNCOV
57
        if !filepath.IsAbs(s) {
×
58
                return errors.New("need an absolute path")
×
59
        }
×
60

UNCOV
61
        return nil
×
62
}
63

UNCOV
64
func Dump() string {
×
UNCOV
65
        return dump(CfgSkipVerify) +
×
UNCOV
66
                dump(CfgVerbose) +
×
UNCOV
67
                dump(CfgWorkDir) +
×
UNCOV
68
                dump(CfgDeploymentsUrl) +
×
UNCOV
69
                dump(CfgDeploymentsUrl)
×
UNCOV
70
}
×
71

UNCOV
72
func dump(n string) string {
×
UNCOV
73
        return fmt.Sprintf("%s: %v\n", n, viper.Get(n))
×
UNCOV
74
}
×
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