Documentation

Overview

Package config defines server configuration and various loaders for them

Index

Constants

This section is empty.

Variables

View Source
var (
	// Commit is the commit hash of this build - can be injected at build time
	Commit string
)

Functions

This section is empty.

Types

type BuildMeta

type BuildMeta struct {
	Commit string
}

BuildMeta denotes build metadata

func NewBuildMeta

func NewBuildMeta() BuildMeta

NewBuildMeta instantiates a new build metadata struct from the environment. Currently leverages Heroku's Dyno Metadata: https://devcenter.heroku.com/articles/dyno-metadata

type Config

type Config struct {
	RedisNamespace string
	RedisURL       string // redis conn string
	RedisAddr      string

	RiotAPIToken string // TODO: need a mechanism to update this

	GitHubToken     string
	GitHubStoreRepo GitHubStoreRepo
}

Config exposes server configuration

func NewEnvConfig

func NewEnvConfig() Config

NewEnvConfig instatiates configuration from environment

func (*Config) DefaultRedisPool

func (c *Config) DefaultRedisPool(opts ...redis.DialOption) *redis.Pool

DefaultRedisPool inits a default redis configuration

func (*Config) GitHubAPITokenSource

func (c *Config) GitHubAPITokenSource() oauth2.TokenSource

GitHubAPITokenSource inits a static token source from this configuration

type Flags

type Flags struct {
	Dev        bool
	LogPath    string
	JobsUIPort string
	APIPort    string
	// contains filtered or unexported fields
}

Flags contains command-line flag configuration

func LoadFlags

func LoadFlags(args []string) (Flags, error)

LoadFlags loads flags from the given set of arguments

func (Flags) Mode

func (f Flags) Mode() Mode

Mode returns the configured operational mode

type GitHubStoreRepo

type GitHubStoreRepo struct {
	Owner string
	Repo  string
}

GitHubStoreRepo configures where data goes

type Mode

type Mode string

Mode denotes operational mode for a run

const (
	// ModeAll starts the server, worker, and if enabled, the jobs UI
	ModeAll Mode = "all"
	// ModeServer starts the server and if enabled, the jobs UI
	ModeServer Mode = "server"
	// ModeWorker starts the worker and if enabled, the jobs UI
	ModeWorker Mode = "worker"
	// ModeJobsUIOnly starts just the jobs UI
	ModeJobsUIOnly Mode = "jobs-ui-only"
)