mirror of
https://github.com/thegeeklab/wp-s3-action.git
synced 2024-11-24 14:00:40 +00:00
Added logrus, added env-file flag, disabled autoload
This commit is contained in:
parent
7886f2f1db
commit
13dbb7ac0f
14
main.go
14
main.go
@ -1,11 +1,11 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/Sirupsen/logrus"
|
||||||
|
"github.com/joho/godotenv"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
_ "github.com/joho/godotenv/autoload"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var version string // build number set at compile-time
|
var version string // build number set at compile-time
|
||||||
@ -90,14 +90,22 @@ func main() {
|
|||||||
Usage: "id of cloudfront distribution to invalidate",
|
Usage: "id of cloudfront distribution to invalidate",
|
||||||
EnvVar: "PLUGIN_CLOUDFRONT_DISTRIBUTION",
|
EnvVar: "PLUGIN_CLOUDFRONT_DISTRIBUTION",
|
||||||
},
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "env-file",
|
||||||
|
Usage: "source env file",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
log.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func run(c *cli.Context) error {
|
func run(c *cli.Context) error {
|
||||||
|
if c.String("env-file") != "" {
|
||||||
|
_ = godotenv.Load(c.String("env-file"))
|
||||||
|
}
|
||||||
|
|
||||||
plugin := Plugin{
|
plugin := Plugin{
|
||||||
Key: c.String("access-key"),
|
Key: c.String("access-key"),
|
||||||
Secret: c.String("secret-key"),
|
Secret: c.String("secret-key"),
|
||||||
|
Loading…
Reference in New Issue
Block a user