Skip to content

Commit

Permalink
allow to pass the token via env var GOTIFY_TOKEN
Browse files Browse the repository at this point in the history
Passing the token as an argument has the implication that the token will
show up in the process list.
To solve this issue an environment variable `GOTIFY_TOKEN` can be used
to pass the token to gotify.

Example:

```
GOTIFY_TOKEN=app_token_here
MSG="Test message"

gotify push $MSG
```
  • Loading branch information
tessus authored and jmattheis committed May 8, 2023
1 parent 4f12199 commit 1ddc49a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ OPTIONS:
--priority value, -p value Set the priority (default: 0)
--exec value, -x value Pass command to exec (default: "sh -c")
--title value, -t value Set the title (empty for command)
--token value Override the app token
--token value Override the app token [$GOTIFY_TOKEN]
--url value Override the Gotify URL
--output value, -o value Output verbosity (short|default|long) (default: "default")
```
Expand All @@ -163,7 +163,7 @@ DESCRIPTION:
OPTIONS:
--priority value, -p value Set the priority (default: 0)
--title value, -t value Set the title (empty for app name)
--token value Override the app token
--token value Override the app token [$GOTIFY_TOKEN]
--url value Override the Gotify URL
--quiet, -q Do not output anything (on success)
--contentType value The content type of the message. See https://gotify.net/docs/msgextras#client-display
Expand Down
2 changes: 1 addition & 1 deletion command/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func Push() cli.Command {
Flags: []cli.Flag{
cli.IntFlag{Name: "priority,p", Usage: "Set the priority"},
cli.StringFlag{Name: "title,t", Usage: "Set the title (empty for app name)"},
cli.StringFlag{Name: "token", Usage: "Override the app token"},
cli.StringFlag{Name: "token", Usage: "Override the app token", EnvVar: "GOTIFY_TOKEN"},
cli.StringFlag{Name: "url", Usage: "Override the Gotify URL"},
cli.BoolFlag{Name: "quiet,q", Usage: "Do not output anything (on success)"},
cli.StringFlag{Name: "contentType", Usage: "The content type of the message. See https://gotify.net/docs/msgextras#client-display"},
Expand Down
2 changes: 1 addition & 1 deletion command/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func Watch() cli.Command {
cli.IntFlag{Name: "priority,p", Usage: "Set the priority"},
cli.StringFlag{Name: "exec,x", Usage: "Pass command to exec", Value: "sh -c"},
cli.StringFlag{Name: "title,t", Usage: "Set the title (empty for command)"},
cli.StringFlag{Name: "token", Usage: "Override the app token"},
cli.StringFlag{Name: "token", Usage: "Override the app token", EnvVar: "GOTIFY_TOKEN"},
cli.StringFlag{Name: "url", Usage: "Override the Gotify URL"},
cli.StringFlag{Name: "output,o", Usage: "Output verbosity (short|default|long)", Value: "default"},
},
Expand Down

0 comments on commit 1ddc49a

Please sign in to comment.