config

package
v0.0.0-...-cea9070 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2016 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version is the version for this build, set at build time via LDFLAGS
	Version string
	// GitHash is the short-form commit hash of this build, set at build time
	GitHash string
)

Functions

func ApplyTemplate

func ApplyTemplate(config []byte) ([]byte, error)

ApplyTemplate creates and renders a template from the given config template

Types

type Config

type Config struct {
	Consul          string          `json:"consul,omitempty"`
	Etcd            json.RawMessage `json:"etcd,omitempty"`
	LogConfig       *LogConfig      `json:"logging,omitempty"`
	OnStart         json.RawMessage `json:"onStart,omitempty"`
	PreStart        json.RawMessage `json:"preStart,omitempty"`
	PreStop         json.RawMessage `json:"preStop,omitempty"`
	PostStop        json.RawMessage `json:"postStop,omitempty"`
	StopTimeout     int             `json:"stopTimeout"`
	ServicesConfig  json.RawMessage `json:"services,omitempty"`
	BackendsConfig  json.RawMessage `json:"backends,omitempty"`
	TasksConfig     json.RawMessage `json:"tasks,omitempty"`
	TelemetryConfig json.RawMessage `json:"telemetry,omitempty"`
	Services        []*services.Service
	Backends        []*backends.Backend
	Tasks           []*tasks.Task
	Telemetry       *telemetry.Telemetry
	PreStartCmd     *exec.Cmd
	PreStopCmd      *exec.Cmd
	PostStopCmd     *exec.Cmd
	Command         *exec.Cmd
	QuitChannels    []chan bool
	ConfigFlag      string
}

Config is the top-level ContainerPilot Configuration

func GetConfig

func GetConfig() *Config

func LoadConfig

func LoadConfig() (*Config, error)

func ReloadConfig

func ReloadConfig(configFlag string) (*Config, error)

type ConfigTemplate

type ConfigTemplate struct {
	Template *template.Template
	Env      Environment
}

ConfigTemplate encapsulates a golang template and its associated environment variables.

func NewConfigTemplate

func NewConfigTemplate(config []byte) (*ConfigTemplate, error)

NewConfigTemplate creates a ConfigTemplate parsed from the configuration and the current environment variables

func (*ConfigTemplate) Execute

func (c *ConfigTemplate) Execute() ([]byte, error)

Execute renders the template

type DefaultLogFormatter

type DefaultLogFormatter struct {
}

DefaultLogFormatter delegates formatting to standard go log package

func (*DefaultLogFormatter) Format

func (f *DefaultLogFormatter) Format(entry *logrus.Entry) ([]byte, error)

Format formats the logrus entry by passing it to the "log" package

type Environment

type Environment map[string]string

Environment is a map of environment variables to their values

type LogConfig

type LogConfig struct {
	Level  string `json:"level"`
	Format string `json:"format,omitempty"`
	Output string `json:"output,omitempty"`
}

LogConfig configures the log levels

Jump to

Keyboard shortcuts

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