mnd

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package mnd provides reusable constants for the Notifiarr application packages.

Index

Constants

View Source
const (
	Mode0755      = 0o755
	Mode0750      = 0o750
	Mode0600      = 0o600
	Kilobyte      = 1024
	Megabyte      = Kilobyte * Kilobyte
	KB100         = Kilobyte * 100
	OneDay        = 24 * time.Hour
	Base10        = 10
	Base8         = 8
	Bits64        = 64
	Bits32        = 32
	True          = "true"
	False         = "false"
	Windows       = "windows"
	Disabled      = "disabled"
	Success       = "success"
	Status        = "Status"
	BytesReceived = " Bytes Received"
	BytesSent     = " Bytes Sent"
	Matched       = " Matched"
	Requests      = " Requests"
	Deleted       = "deleted:"
	HelpLink      = "Notifiarr Discord: https://notifiarr.com/discord"
	UserRepo      = "Notifiarr/notifiarr"
	BugIssue      = "This is a bug please report it on github: https://github.com/" + UserRepo + "/issues/new"
	Synology      = "/etc/synoinfo.conf" // Synology is the path to the syno config file.
	IsLinux       = runtime.GOOS == "linux"
	IsWindows     = runtime.GOOS == Windows
	IsFreeBSD     = runtime.GOOS == "freebsd"
)

Application Constants.

View Source
const (
	Title            = "Notifiarr"
	DefaultName      = "notifiarr"
	DefaultLogFileMb = 100
	DefaultLogFiles  = 0 // delete none
	DefaultEnvPrefix = "DN"
	DefaultTimeout   = time.Minute
	DefaultBindAddr  = "0.0.0.0:5454"
)

Application Defaults.

Variables

View Source
var (
	LogFiles      = GetMap("Log File Information").Init()
	APIHits       = GetMap("Incoming API Requests").Init()
	HTTPRequests  = GetMap("Incoming HTTP Requests").Init()
	TimerEvents   = GetMap("Triggers and Timers Executed").Init()
	TimerCounts   = GetMap("Triggers and Timers Counters").Init()
	Website       = GetMap("Outbound Requests to Website").Init()
	ServiceChecks = GetMap("Service Check Responses").Init()
	Apps          = GetMap("Starr App Requests").Init()
	FileWatcher   = GetMap("File Watcher").Init()
)
View Source
var (
	// IsSynology tells us if this we're running on a Synology.
	IsSynology bool
	// IsDocker tells us if this is our Docker container.
	IsDocker   = os.Getpid() == 1
	IsUnstable = strings.HasPrefix(version.Branch, "unstable")
)
View Source
var ErrDisabledInstance = fmt.Errorf("instance is administratively disabled")

ErrDisabledInstance is returned when a request for a disabled instance is performed.

Functions

func DurationAgo added in v0.7.1

func DurationAgo(when time.Time) string

DurationAgo returns an elapsed-time formatted for humans. Print this after a date to show how long ago it was.

func FormatBytes added in v0.5.0

func FormatBytes(size interface{}) string

FormatBytes converts a byte counter into a pretty UI string. The input val must be int, int64, uint64 or float64.

func GetKeys added in v0.4.1

func GetKeys(mapName *expvar.Map) map[string]interface{}

func GetMap added in v0.4.1

func GetMap(name string) *expvar.Map

func GetSplitKeys added in v0.4.1

func GetSplitKeys(mapName *expvar.Map) map[string]map[string]interface{}

func TodaysEmoji added in v0.3.3

func TodaysEmoji() string

TodaysEmoji returns an emoji specific to the month (or perhaps date).

Types

type AllData added in v0.4.1

type AllData struct {
	LogFiles      map[string]interface{}
	APIHits       map[string]interface{}
	HTTPRequests  map[string]interface{}
	TimerEvents   map[string]map[string]interface{}
	TimerCounts   map[string]interface{}
	Website       map[string]interface{}
	ServiceChecks map[string]map[string]interface{}
	Apps          map[string]map[string]interface{}
	FileWatcher   map[string]interface{}
}

func GetAllData added in v0.4.1

func GetAllData() AllData

type Logger added in v0.3.2

type Logger interface {
	Print(v ...interface{})
	Printf(msg string, v ...interface{})
	Error(v ...interface{})
	Errorf(msg string, v ...interface{})
	ErrorfNoShare(msg string, v ...interface{})
	Debug(v ...interface{})
	Debugf(msg string, v ...interface{})
	GetInfoLog() *log.Logger
	DebugEnabled() bool
	CapturePanic()
}

Logger is an interface for our logs package. We use this to avoid an import cycle.

Jump to

Keyboard shortcuts

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