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:
Michael de Wit 2020-08-02 12:28:25 +02:00 committed by GitHub
commit 28bc16668a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,8 +10,12 @@ import (
func main() {
// Load env-file if it exists first
if env := os.Getenv("PLUGIN_ENV_FILE"); env != "" {
godotenv.Load(env)
envFile, envFileSet := os.LookupEnv("PLUGIN_ENV_FILE")
if !envFileSet {
envFile = "/run/drone/env"
}
if _, err := os.Stat(envFile); err == nil {
godotenv.Overload(envFile)
}
app := cli.NewApp()
@ -91,7 +95,6 @@ func main() {
EnvVar: "EMAIL_CLIENTHOSTNAME,PLUGIN_CLIENTHOSTNAME",
},
// Drone environment
// Repo
cli.StringFlag{