6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-08 05:49:20 +00:00

Refactor config provider using viper

This commit is contained in:
Grzegorz Dlugoszewski
2020-06-04 11:38:01 +02:00
parent 205eecc073
commit f2d8496136
7 changed files with 142 additions and 130 deletions

View File

@@ -7,6 +7,7 @@ import (
"strings"
"github.com/pkg/errors"
"github.com/spf13/viper"
)
// scpSyntax matches the SCP-like addresses used by the ssh protocol (eg, [user@]host.xz:path/to/repo.git/).
@@ -45,7 +46,7 @@ func ParseURL(rawURL string) (url *urlpkg.URL, err error) {
// Default to configured defaultHost when host is empty
if url.Host == "" {
url.Host = Cfg.DefaultHost()
url.Host = viper.GetString(KeyDefaultHost)
}
// Default to https when scheme is empty