From 13dbb7ac0f8a60b7435ddc64f53f2a97b63e97e1 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Mon, 22 Aug 2016 21:32:40 +0200 Subject: [PATCH] Added logrus, added env-file flag, disabled autoload --- main.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index ff0729a..4bfc2b0 100644 --- a/main.go +++ b/main.go @@ -1,11 +1,11 @@ package main import ( - "log" "os" + "github.com/Sirupsen/logrus" + "github.com/joho/godotenv" "github.com/urfave/cli" - _ "github.com/joho/godotenv/autoload" ) var version string // build number set at compile-time @@ -90,14 +90,22 @@ func main() { Usage: "id of cloudfront distribution to invalidate", EnvVar: "PLUGIN_CLOUDFRONT_DISTRIBUTION", }, + cli.StringFlag{ + Name: "env-file", + Usage: "source env file", + }, } if err := app.Run(os.Args); err != nil { - log.Fatal(err) + logrus.Fatal(err) } } func run(c *cli.Context) error { + if c.String("env-file") != "" { + _ = godotenv.Load(c.String("env-file")) + } + plugin := Plugin{ Key: c.String("access-key"), Secret: c.String("secret-key"),