Skip to content

Commit

Permalink
refactor: environment variable loading mechanism (#85)
Browse files Browse the repository at this point in the history
- Remove unused import for `github.com/joho/godotenv/autoload`
- Add conditional loading of environment variables from `/run/drone/env` if the file exists

Signed-off-by: appleboy <[email protected]>
  • Loading branch information
appleboy authored Jun 29, 2024
1 parent 8535838 commit 890cfe5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"time"

"github.com/joho/godotenv"
_ "github.com/joho/godotenv/autoload"
"github.com/urfave/cli/v2"
)

Expand All @@ -22,6 +21,10 @@ func main() {
_ = godotenv.Load(filename)
}

if _, err := os.Stat("/run/drone/env"); err == nil {
_ = godotenv.Overload("/run/drone/env")
}

app := cli.NewApp()
app.Name = "Drone Lambda"
app.Usage = "Deploying Lambda code with drone CI to an existing function"
Expand Down

0 comments on commit 890cfe5

Please sign in to comment.