mirror of
https://github.com/thegeeklab/wp-docker-buildx.git
synced 2024-11-24 23:00:39 +00:00
Merge pull request #89 from jmccann/read_version_file
Load env-file before initializing/running CLI
This commit is contained in:
commit
14432cac98
@ -1,5 +1,6 @@
|
||||
workspace:
|
||||
base: /go
|
||||
path: src/github.com/drone-plugins/drone-docker
|
||||
|
||||
pipeline:
|
||||
test:
|
||||
|
13
main.go
13
main.go
@ -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{
|
||||
|
Loading…
Reference in New Issue
Block a user