allow to pass the token via env var GOTIFY_TOKEN

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
```
This commit is contained in:
Helmut K. C. Tessarek
2023-05-07 11:39:21 -04:00
committed by Jannis Mattheis
parent 4f1219962e
commit 1ddc49a1e5
3 changed files with 4 additions and 4 deletions

View File

@@ -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")
```
@@ -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

View File

@@ -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"},

View File

@@ -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"},
},