notifications

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const ColorHex = "#406170"

ColorHex is the default notification color used for services that support it (formatted as a CSS hex string)

View Source
const ColorInt = 0x406170

ColorInt is the default notification color used for services that support it (as an int value)

Variables

View Source
var LocalLog = log.WithField("notify", "no")

LocalLog is a logrus logger that does not send entries as notifications

Functions

func AppendLegacyUrls

func AppendLegacyUrls(urls []string, cmd *cobra.Command) ([]string, time.Duration)

AppendLegacyUrls creates shoutrrr equivalent URLs from legacy notification flags

func GetDelay

func GetDelay(c *cobra.Command, legacyDelay time.Duration) time.Duration

GetDelay returns the legacy delay if defined, otherwise the delay as set by args is returned

func GetScheme

func GetScheme(url string) string

GetScheme returns the scheme part of a Shoutrrr URL

func GetTitle

func GetTitle(hostname string, tag string) string

GetTitle formats the title based on the passed hostname and tag

func NewNotifier

func NewNotifier(c *cobra.Command) ty.Notifier

NewNotifier creates and returns a new Notifier, using global configuration.

Types

type Data

type Data struct {
	StaticData
	Entries []*log.Entry
	Report  t.Report
}

Data is the notification template data model

func (Data) MarshalJSON

func (d Data) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

type StaticData

type StaticData struct {
	Title string
	Host  string
}

StaticData is the part of the notification template data model set upon initialization

func GetTemplateData

func GetTemplateData(c *cobra.Command) StaticData

GetTemplateData populates the static notification data from flags and environment

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL