You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nu-scripts/lib/cntfy.nu

30 lines
591 B
Plaintext

use ./config.nu
# Publishes a message
export def publish [
topic: string
message: string
--title: string
--priority: number
--tags: list<string>
--actions: list<any>
--icon: string
] {
let cfg = ( config read_file cntfy )
if ( $env.NTFY_LIMIT? == 0) {
sleep 5sec
let-env NTFY_LIMIT = 3
}
let request_body = ({
topic: $topic
title: $title
message: $message
tags: ( $tags | append ( hostname ) )
priority: $priority
actions: $actions
icon: $icon
} | to json )
http put -u $cfg.username -p $cfg.password $cfg.url $request_body
}