Load PLUGIN_ENV_FILE before app
This commit is contained in:
		
							parent
							
								
									634e2c9329
								
							
						
					
					
						commit
						cb765bef60
					
				| @ -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
	 Jacob McCann
						Jacob McCann