config

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Awtrix

type Awtrix struct {
	SelfDestruct  bool              `koanf:"selfDestruct"`
	UpcomingLimit time.Duration     `koanf:"upcomingLimit"`
	Messages      AwtrixMessagesSet `koanf:"messages"`
}

type AwtrixMessage

type AwtrixMessage struct {
	// The text to display
	Text string `koanf:"text"`
	// Changes the Uppercase setting. 0=global setting, 1=forces uppercase; 2=shows as it sent
	TextCase int `koanf:"textCase"`
	// Draw the text on top
	TopText bool `koanf:"topText"`
	//Sets an offset for the x position of a starting text
	TextOffset int `koanf:"textOffset"`
	// The text, bar or line color (#hex)
	Color string `koanf:"color"`
	// Sets a background color (#hex)
	Background string `koanf:"background"`
	// Fades each letter in the text differently through the entire RGB spectrum
	Rainbow bool `koanf:"rainbow"`
	// The icon ID or filename (without extension) to display on the app
	Icon string `koanf:"icon"`
	// 0 = Icon doesn't move. 1 = Icon moves with text and will not appear again. 2 = Icon moves with text but appears again when the text starts to scroll again.
	PushIcon int `koanf:"pushIcon"`
	// Sets how many times the text should be scrolled through the matrix before the app ends
	Repeat int `koanf:"repeat"`
	// Sets how long the app or notification should be displayed
	Duration int `koanf:"duration"`
	// Enables or disables autoscaling for bar and linechart
	Autoscale bool `koanf:"autoscale"`
	//  Defines the position of your custompage in the loop, starting at 0 for the first position. This will only apply with your first push. This function is experimental
	Pos int `koanf:"pos"`
	// Removes the custom app when there is no update after the given time in seconds
	Lifetime int `koanf:"lifetime"`
	// Defines if the **notification** will be stacked. false will immediately replace the current notification
	Stack bool `koanf:"stack"`
	// If the Matrix is off, the notification will wake it up for the time of the notification
	Wakeup bool `koanf:"wakeup"`
	// Disables the textscrolling
	NoScroll bool `koanf:"noScroll"`
	// Modifies the scrollspeed. You need to enter a percentage value
	ScrollSpeed int `koanf:"scrollSpeed"`
	// Shows an (https://blueforcer.github.io/awtrix-light/#/effects) as background
	Effect string `koanf:"effect"`
	// Changes color and speed of the (https://blueforcer.github.io/awtrix-light/#/effects)
	EffectSettings map[string]any `koanf:"effectSettings"`
}

type AwtrixMessagesSet

type AwtrixMessagesSet struct {
	None     AwtrixMessage `koanf:"none"`
	Upcoming AwtrixMessage `koanf:"upcoming"`
	OnAir    AwtrixMessage `koanf:"onAir"`
}

type Calendar

type Calendar struct {
	SourceURL string `koanf:"sourceUrl"`
	Timezone  string `koanf:"timezone"`
}

func (*Calendar) Validate

func (c *Calendar) Validate() error

type Config

type Config struct {
	Verbose  bool     `koanf:"verbose"`
	Calendar Calendar `koanf:"calendar"`
	Ticker   Ticker   `koanf:"ticker"`
	Mqtt     Mqtt     `koanf:"mqtt"`
	Awtrix   Awtrix   `koanf:"awtrix"`
}

func LoadConfig

func LoadConfig(files ...string) (*Config, error)

func (*Config) NewRuntime

func (c *Config) NewRuntime() (*Runtime, error)

func (*Config) Validate

func (c *Config) Validate() error

type Mqtt

type Mqtt struct {
	Upstream string `koanf:"upstream"`
	Username string `koanf:"username"`
	Password string `koanf:"password"`
	Topic    string `koanf:"topic"`
}

func (*Mqtt) Validate

func (c *Mqtt) Validate() error

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

func (*Runtime) NewAwtrixUpdater

func (r *Runtime) NewAwtrixUpdater() (*awtrix.MqttUpdater, error)

func (*Runtime) NewCalendar

func (r *Runtime) NewCalendar() (calendar.Calendar, error)

func (*Runtime) NewTicker

func (r *Runtime) NewTicker() (ticker.Ticker, error)

type Ticker

type Ticker struct {
	Jitter        time.Duration `koanf:"jitter"`
	PreviewLimit  time.Duration `koanf:"previewLimit"`
	FetchInterval time.Duration `koanf:"fetchInterval"`
	TickInterval  time.Duration `koanf:"tickInterval"`
}

func (*Ticker) Validate

func (c *Ticker) Validate() error

Jump to

Keyboard shortcuts

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