[GH-ISSUE #103] [CLI] read topic, priority, etc from environment variables or config file #84

Closed
opened 2026-05-07 00:19:42 +02:00 by BreizhHardware · 3 comments

Originally created by @kzshantonu on GitHub (Jan 17, 2022).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/103

If a topic, priority, etc is not specified when using ntfy publish, the CLI tool could read value from config file or environment. Could be handy for users who push to one topic most of the time

Originally created by @kzshantonu on GitHub (Jan 17, 2022). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/103 If a topic, priority, etc is not specified when using `ntfy publish`, the CLI tool could read value from config file or environment. Could be handy for users who push to one topic most of the time
BreizhHardware 2026-05-07 00:19:42 +02:00
Author
Owner

@binwiederhier commented on GitHub (Jan 19, 2022):

The syntax for the publish command is this: ntfy publish TOPIC [MESSAGE...], so you could write:

ntfy pub mytopic "my message"
ntfy pub mytopic my message
ntfy pub mytopic   # sends the message "triggered"

Since topic is the first argument, it's quite impossible to leave it blank, e.g. this:

ntfy pub "my message" 

would not work, because the first argument is the topic, not the message. The best I could do is this:

ntfy pub . "my message"  # where . means "use env"

# or this

ntfy pub -T "my message" # where -T means "use env"

but that's super ugly.

Thoughts?

<!-- gh-comment-id:1016794214 --> @binwiederhier commented on GitHub (Jan 19, 2022): The syntax for the publish command is this: `ntfy publish TOPIC [MESSAGE...]`, so you could write: ``` ntfy pub mytopic "my message" ntfy pub mytopic my message ntfy pub mytopic # sends the message "triggered" ``` Since topic is the first argument, it's quite impossible to leave it blank, e.g. this: ``` ntfy pub "my message" ``` would not work, because the first argument is the topic, not the message. The best I could do is this: ``` ntfy pub . "my message" # where . means "use env" # or this ntfy pub -T "my message" # where -T means "use env" ``` but that's super ugly. Thoughts?
Author
Owner

@kzshantonu commented on GitHub (Jan 20, 2022):

I guess dot is easier to type

<!-- gh-comment-id:1017090746 --> @kzshantonu commented on GitHub (Jan 20, 2022): I guess dot is easier to type
Author
Owner

@binwiederhier commented on GitHub (Feb 2, 2022):

Implemented in github.com/binwiederhier/ntfy@1552d8103e as

NTFY_TOPIC=mytopic ntfy pub -P "my message"
<!-- gh-comment-id:1027571732 --> @binwiederhier commented on GitHub (Feb 2, 2022): Implemented in https://github.com/binwiederhier/ntfy/commit/1552d8103e8c2f02677fa5c6f0a07a5f265b8085 as ``` NTFY_TOPIC=mytopic ntfy pub -P "my message" ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#84
No description provided.