commit
91ae3a4c55
1
.gitignore
vendored
1
.gitignore
vendored
@ -25,3 +25,4 @@ _testmain.go
|
||||
vendor
|
||||
drone-telegram
|
||||
coverage.txt
|
||||
.env
|
||||
|
10
README.md
10
README.md
@ -83,3 +83,13 @@ docker run --rm \
|
||||
-w $(pwd) \
|
||||
appleboy/drone-telegram
|
||||
```
|
||||
|
||||
Load all environments from file.
|
||||
|
||||
```bash
|
||||
docker run --rm \
|
||||
-e ENV_FILE=your_env_file_path \
|
||||
-v $(pwd):$(pwd) \
|
||||
-w $(pwd) \
|
||||
appleboy/drone-telegram
|
||||
```
|
||||
|
10
main.go
10
main.go
@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
_ "github.com/joho/godotenv/autoload"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
@ -156,11 +157,20 @@ func main() {
|
||||
Usage: "job finished",
|
||||
EnvVar: "DRONE_JOB_FINISHED",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "env-file",
|
||||
Usage: "source env file",
|
||||
EnvVar: "ENV_FILE",
|
||||
},
|
||||
}
|
||||
app.Run(os.Args)
|
||||
}
|
||||
|
||||
func run(c *cli.Context) error {
|
||||
if c.String("env-file") != "" {
|
||||
_ = godotenv.Load(c.String("env-file"))
|
||||
}
|
||||
|
||||
plugin := Plugin{
|
||||
Repo: Repo{
|
||||
Owner: c.String("repo.owner"),
|
||||
|
Loading…
Reference in New Issue
Block a user