Skip to content

Commit

Permalink
increase default envkey-fetch timeout to 6 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
danenania committed Sep 8, 2018
1 parent a31f73f commit 418668c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fetch/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ type FetchOptions struct {
var DefaultHost = "env.envkey.com"
var BackupDefaultHost = "s3-eu-west-1.amazonaws.com/envkey-backup/envs"
var ApiVersion = 1
var HttpGetter = myhttp.New(time.Second * 2)
var HttpGetter = myhttp.New(time.Second * 6)

func Fetch(envkey string, options FetchOptions) (string, error) {
if len(strings.Split(envkey, "-")) < 2 {
return "", errors.New("ENVKEY invalid")
}

if options.TimeoutSeconds != 2.0 {
if options.TimeoutSeconds != 6.0 {
HttpGetter = myhttp.New(time.Second * time.Duration(options.TimeoutSeconds))
}

Expand Down Expand Up @@ -146,7 +146,7 @@ func getBaseUrl(envkeyHost string, envkeyParam string) string {
host = envkeyHost
}

if strings.Contains(host, "localhost") {
if strings.Split(host, ":")[0] == "localhost" {
protocol = "http://"
} else {
protocol = "https://"
Expand Down

0 comments on commit 418668c

Please sign in to comment.