0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-10 03:30:40 +00:00

Merge pull request #89 from jmccann/read_version_file

Load env-file before initializing/running CLI
This commit is contained in:
Brad Rydzewski 2016-11-09 00:55:08 +00:00 committed by GitHub
commit 14432cac98
2 changed files with 6 additions and 8 deletions

View File

@ -1,5 +1,6 @@
workspace:
base: /go
path: src/github.com/drone-plugins/drone-docker
pipeline:
test:

13
main.go
View File

@ -12,6 +12,11 @@ import (
var build = "0" // build number set at compile-time
func main() {
// Load env-file if it exists first
if env := os.Getenv("PLUGIN_ENV_FILE"); env != "" {
godotenv.Load(env)
}
app := cli.NewApp()
app.Name = "docker plugin"
app.Usage = "docker plugin"
@ -129,10 +134,6 @@ func main() {
Usage: "docker email",
EnvVar: "DOCKER_EMAIL,PLUGIN_EMAIL",
},
cli.StringFlag{
Name: "env-file",
Usage: "source env file",
},
}
if err := app.Run(os.Args); err != nil {
@ -141,10 +142,6 @@ func main() {
}
func run(c *cli.Context) error {
if c.String("env-file") != "" {
_ = godotenv.Load(c.String("env-file"))
}
plugin := Plugin{
Dryrun: c.Bool("dry-run"),
Login: Login{