gocrazy_permanent_data

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigLocation = "/perm/icof/start-config.json"

ConfigLocation is used to load the config required for icof to start. gokrazy stores the permanent data under the /perm directory

View Source
var StateLocation = "/perm/icof/state.json"

StateLocation where the state will be stored

Functions

This section is empty.

Types

type EmailAddress

type EmailAddress struct {
	Email   string `json:"email"`
	Name    string `json:"name"`
	Surname string `json:"surname"`
}

type EmailClientConfig

type EmailClientConfig struct {
	Host             string `json:"host"`
	Port             int    `json:"port"`
	Username         string `json:"username"`
	Password         string `json:"password"`
	FromEmailAddress string `json:"from_email_address"`
}

type EmailReceiver

type EmailReceiver struct {
	Name                   string         `json:"name"`
	AlertTemplateMessage   string         `json:"alert_template_message"`
	ResolveTemplateMessage string         `json:"resolve_template_message"`
	Addresses              []EmailAddress `json:"addresses"`
}

type EmailReceiverConfig

type EmailReceiverConfig struct {
	AlertSubject   string          `json:"alert_subject"`
	ResolveSubject string          `json:"resolve_subject"`
	Receivers      []EmailReceiver `json:"receivers"`
}

type SavedState

type SavedState struct {
	State icof.ObserverState `json:"state"`
}

SavedState content for state file

type StartUpConfig

type StartUpConfig struct {
	EmailClientConfig   EmailClientConfig   `json:"email_config"`
	EmailReceiverConfig EmailReceiverConfig `json:"email_receiver_config"`
}

StartUpConfig holds all required properties for icof to start

func New

func New() (StartUpConfig, error)

New loads the startup config from disk

func (StartUpConfig) GetEmailReceivers

func (c StartUpConfig) GetEmailReceivers(ctx context.Context) ([]notifier.EmailReceiver, error)

GetEmailReceivers implements the notifier.EmailReceiverRepository

type State

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

State implements the icof.StateRepository

func NewStateRepository

func NewStateRepository() *State

NewStateRepository init a new State repository

func (*State) GetLatest

func (s *State) GetLatest(ctx context.Context) (icof.ObserverState, error)

GetLatest gets state from state file under StateLocation

func (*State) Save

func (s *State) Save(ctx context.Context, state icof.ObserverState) error

Save stores state in state file under StateLocation

Jump to

Keyboard shortcuts

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