From 224e580befb5b9f95d455bec0fe613ff8f927f8c Mon Sep 17 00:00:00 2001 From: b4b4r07 Date: Sun, 3 Dec 2017 21:21:31 +0900 Subject: [PATCH] Can be overwritten with environment variable --- main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 9614a10..e37bade 100644 --- a/main.go +++ b/main.go @@ -62,15 +62,20 @@ func run(args []string) int { fmt.Fprintf(os.Stderr, "Error: %s\n", err.Error()) return 1 default: - url = args[0] + // url = args[0] } + url = args[len(args)-1] + env, err := cfg.GetEnv(url) if err != nil { fmt.Fprintf(os.Stderr, "Error: %s\n", err.Error()) fmt.Fprintf(os.Stderr, " similar urls found %q\n", cfg.SimilarURLs(url)) return 1 } + credentials = os.Getenv(GoogleApplicationCredentials) + clientID = os.Getenv(IAPClientID) + binary = os.Getenv(IAPCurlBinary) if credentials == "" { credentials, _ = homedir.Expand(env.Credentials) }