alert

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(config AlertConfig)

Init inits alert with provided configurations.

func InitDingTalk

func InitDingTalk(config *DingTalkConfig, customTags []string)

InitDingTalk inits DingTalk with provided configurations.

func MustInitFromViper

func MustInitFromViper()

MustInitFromViper inits alert from viper settings or panic on error.

func SendDingTalkTextMessage

func SendDingTalkTextMessage(level, brief, detail string) error

SendDingTalkTextMessage sends text message to DingTalk group chat.

Types

type AlertConfig

type AlertConfig struct {
	// Custom tags are usually used to differentiate between different networks and enviroments
	// such as mainnet/testnet, prod/test/dev or any custom info for more details.
	CustomTags []string `default:"[dev,test]"`

	// DingTalk settings
	DingTalk DingTalkConfig
}

AlertConfig alert configuration such as DingTalk settings etc.

type DingTalkConfig

type DingTalkConfig struct {
	Enabled   bool     // switch to turn on or off DingTalk
	AtMobiles []string // mobiles for @ members
	IsAtAll   bool     // whether to @ all members
	Webhook   string   // webhook url
	Secret    string   // secret token
}

DingTalkConfig DingTalk configurations

Jump to

Keyboard shortcuts

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