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:
commit
14432cac98
@ -1,5 +1,6 @@
|
|||||||
workspace:
|
workspace:
|
||||||
base: /go
|
base: /go
|
||||||
|
path: src/github.com/drone-plugins/drone-docker
|
||||||
|
|
||||||
pipeline:
|
pipeline:
|
||||||
test:
|
test:
|
||||||
|
13
main.go
13
main.go
@ -12,6 +12,11 @@ import (
|
|||||||
var build = "0" // build number set at compile-time
|
var build = "0" // build number set at compile-time
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
// Load env-file if it exists first
|
||||||
|
if env := os.Getenv("PLUGIN_ENV_FILE"); env != "" {
|
||||||
|
godotenv.Load(env)
|
||||||
|
}
|
||||||
|
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
app.Name = "docker plugin"
|
app.Name = "docker plugin"
|
||||||
app.Usage = "docker plugin"
|
app.Usage = "docker plugin"
|
||||||
@ -129,10 +134,6 @@ func main() {
|
|||||||
Usage: "docker email",
|
Usage: "docker email",
|
||||||
EnvVar: "DOCKER_EMAIL,PLUGIN_EMAIL",
|
EnvVar: "DOCKER_EMAIL,PLUGIN_EMAIL",
|
||||||
},
|
},
|
||||||
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 {
|
||||||
@ -141,10 +142,6 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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{
|
||||||
Dryrun: c.Bool("dry-run"),
|
Dryrun: c.Bool("dry-run"),
|
||||||
Login: Login{
|
Login: Login{
|
||||||
|
Loading…
Reference in New Issue
Block a user