From 45d47a0966410840dfe4e90584ba0147eb334634 Mon Sep 17 00:00:00 2001 From: Amine Hilaly Date: Wed, 29 May 2019 20:49:55 +0200 Subject: Update configuration process and add unit tests Update launchpad bridge --- bridge/launchpad/config.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'bridge/launchpad/config.go') diff --git a/bridge/launchpad/config.go b/bridge/launchpad/config.go index ef206fd5..1514505f 100644 --- a/bridge/launchpad/config.go +++ b/bridge/launchpad/config.go @@ -7,12 +7,16 @@ import ( "os" "regexp" "strings" + "time" "github.com/MichaelMure/git-bug/bridge/core" "github.com/MichaelMure/git-bug/repository" ) -const keyProject = "project" +const ( + keyProject = "project" + defaultTimeout = 60 * time.Second +) var ( rxLaunchpadURL = regexp.MustCompile(`launchpad\.net[\/:]([^\/]*[a-z]+)`) @@ -92,9 +96,10 @@ func promptProjectName() (string, error) { func validateProject(project string) (bool, error) { url := fmt.Sprintf("%s/%s", apiRoot, project) - client := := &http.Client{ + client := &http.Client{ Timeout: defaultTimeout, } + resp, err := client.Get(url) if err != nil { return false, err -- cgit