config

package
v0.0.0-...-1392edb Latest Latest
Warning

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

Go to latest
Published: May 11, 2019 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextKeyServer ctxKey = iota
	ContextKeyClient
)

Context keys

Variables

View Source
var (
	//GitCommit is injected at build time with the commit hash
	GitCommit = "0"
)

Functions

func GetVersion

func GetVersion() string

GetVersion returns the currently running version

Types

type Client

type Client struct {
	ServerAddress string
	Tracing       struct {
		Enabled       bool
		ServerAddress string
		ServiceName   string
	}
}

Client represents client config

func GetClientConfig

func GetClientConfig(ctx context.Context) *Client

GetClientConfig extracts Client config from context

func LoadClient

func LoadClient() *Client

LoadClient returns client config

func (*Client) InjectIntoContext

func (s *Client) InjectIntoContext(ctx context.Context) context.Context

InjectIntoContext injects Client config into a provided ctx

type DMXProfileMap

type DMXProfileMap map[string]LightProfileDMX

DMXProfileMap represents a map of dmx profiles

type Job

type Job struct {
	Name    string
	Command string
	Cron    string
}

Job holds a cronjob

type LightDMX

type LightDMX struct {
	Name         string
	StartAddress int `mapstructure:"start_address"`
	Universe     int
	Profile      string
}

LightDMX hol;ds config info for a dmx light

type LightGeneric

type LightGeneric struct {
	Name string
}

LightGeneric holds config info for a Generic

type LightHue

type LightHue struct {
	Name  string
	HueID int `mapstructure:"hue_id"`
}

LightHue holds config info for a Hue

type LightProfileDMX

type LightProfileDMX struct {
	Name         string
	Capabilities []string
	Channels     map[string]int
}

LightProfileDMX holds config info for a dmx profile: channel and capability mappings

type Lights

type Lights struct {
	Hue     []LightHue
	DMX     []LightDMX
	Generic []LightGeneric
}

Lights represents the lists of lights, by type

type Server

type Server struct {
	Inputs struct {
		RPC struct {
			Enabled bool
			Address string
		}
		HTTP struct {
			Enabled        bool
			Address        string
			WSTickInterval time.Duration
		}
		HomeKit struct {
			Enabled bool
			Pin     string
		}
	}
	Outputs struct {
		OLA struct {
			Enabled bool
			Address string
			Tick    time.Duration
		}
		Hue struct {
			Enabled  bool
			Address  string
			Username string
		}
	}
	Tracing struct {
		Enabled       bool
		ServerAddress string
		ServiceName   string
	}

	Timings struct {
		FadeInterpolationTick time.Duration
		CueBackoff            time.Duration
	}
	Triggers []Trigger

	Lights      Lights
	DMXProfiles DMXProfileMap
	Commands    UserCommandMap
	Jobs        []Job
}

Server represents server config

func GetServerConfig

func GetServerConfig(ctx context.Context) *Server

GetServerConfig extracts Server config from context

func LoadServer

func LoadServer() *Server

LoadServer returns the server config (using viper)

func (*Server) InjectIntoContext

func (s *Server) InjectIntoContext(ctx context.Context) context.Context

InjectIntoContext injects Server config into a provided ctx

type Trigger

type Trigger struct {
	ID      int
	Source  string
	Command string
}

Trigger holds configuration for a trigger

type UserCommand

type UserCommand struct {
	Body string
}

UserCommand holds a user command

type UserCommandMap

type UserCommandMap map[string]UserCommand

UserCommandMap is used to map user commands by name

Jump to

Keyboard shortcuts

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