Merge pull request #40 from immerrr/add-workaround-for-kubernetes-runner
Use /run/drone/env as default PLUGIN_ENV_FILE, overwrite env vars with it
This commit is contained in:
commit
28bc16668a
13
main.go
13
main.go
|
@ -10,8 +10,12 @@ import (
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Load env-file if it exists first
|
// Load env-file if it exists first
|
||||||
if env := os.Getenv("PLUGIN_ENV_FILE"); env != "" {
|
envFile, envFileSet := os.LookupEnv("PLUGIN_ENV_FILE")
|
||||||
godotenv.Load(env)
|
if !envFileSet {
|
||||||
|
envFile = "/run/drone/env"
|
||||||
|
}
|
||||||
|
if _, err := os.Stat(envFile); err == nil {
|
||||||
|
godotenv.Overload(envFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
|
@ -84,13 +88,12 @@ func main() {
|
||||||
Usage: "attachment filename(s)",
|
Usage: "attachment filename(s)",
|
||||||
EnvVar: "PLUGIN_ATTACHMENTS",
|
EnvVar: "PLUGIN_ATTACHMENTS",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "clienthostname",
|
Name: "clienthostname",
|
||||||
Value: DefaultClientHostname,
|
Value: DefaultClientHostname,
|
||||||
Usage: "smtp client hostname",
|
Usage: "smtp client hostname",
|
||||||
EnvVar: "EMAIL_CLIENTHOSTNAME,PLUGIN_CLIENTHOSTNAME",
|
EnvVar: "EMAIL_CLIENTHOSTNAME,PLUGIN_CLIENTHOSTNAME",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// Drone environment
|
// Drone environment
|
||||||
// Repo
|
// Repo
|
||||||
|
@ -388,7 +391,7 @@ func run(c *cli.Context) error {
|
||||||
Body: c.String("template.body"),
|
Body: c.String("template.body"),
|
||||||
Attachment: c.String("attachment"),
|
Attachment: c.String("attachment"),
|
||||||
Attachments: c.StringSlice("attachments"),
|
Attachments: c.StringSlice("attachments"),
|
||||||
ClientHostname: c.String("clienthostname"),
|
ClientHostname: c.String("clienthostname"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue