notifications

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 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 added in v1.4.0

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

AppendLegacyUrls creates shoutrrr equivalent URLs from legacy notification flags

func GetDelay added in v1.5.0

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 added in v1.4.0

func GetScheme(url string) string

GetScheme returns the scheme part of a Shoutrrr URL

func GetTitle added in v1.2.0

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 added in v1.4.0

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

Data is the notification template data model

func (Data) MarshalJSON added in v1.5.2

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

MarshalJSON implements json.Marshaler

type StaticData added in v1.5.0

type StaticData struct {
	Title string
	Host  string
}

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

func GetTemplateData added in v1.5.0

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