mirror of
https://github.com/appleboy/drone-ssh.git
synced 2025-07-02 21:52:51 +08:00
Add a nodotenv config to disable autoloading .env files
This commit is contained in:
parent
1a95b5f1b3
commit
5d7c8ba4a5
8
main.go
8
main.go
@ -7,7 +7,6 @@ import (
|
||||
|
||||
"github.com/appleboy/easyssh-proxy"
|
||||
"github.com/joho/godotenv"
|
||||
_ "github.com/joho/godotenv/autoload"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@ -15,6 +14,13 @@ import (
|
||||
var Version string
|
||||
|
||||
func main() {
|
||||
// Load dotenv unless explicitly ignored
|
||||
if noAutoEnv, found := os.LookupEnv("PLUGIN_NO_AUTO_ENV"); found {
|
||||
if noAutoEnv != "true" {
|
||||
_ = godotenv.Load()
|
||||
}
|
||||
}
|
||||
|
||||
// Load env-file if it exists first
|
||||
if filename, found := os.LookupEnv("PLUGIN_ENV_FILE"); found {
|
||||
_ = godotenv.Load(filename)
|
||||
|
Loading…
Reference in New Issue
Block a user