models

package
v0.0.0-...-e675719 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSecureServer

func NewSecureServer(config *Config) *http.Server

NewSecureServer creates a new Secure HTTP Server (TLS).

func NewServer

func NewServer(config *Config) *http.Server

NewServer creates a new HTTP Server (nonTLS).

func QueryHTTPMetric

func QueryHTTPMetric(metric *ConfigMetric) (time.Duration, int, []byte, bool, error)

Types

type Config

type Config struct {
	Env           string              `json:"env"`
	TLSEnable     bool                `json:"tlsEnable"`
	TLSCRT        string              `json:"tlsCRT"`
	TLSKey        string              `json:"tlsKey"`
	Port          int                 `json:"port"`
	LogFile       string              `json:"logFile"`
	Name          string              `json:"name"`
	MetricsRouter ConfigMetricsRouter `json:"metricsRouter"`
	Metrics       []ConfigMetric      `json:"metrics"`
}

func NewConfig

func NewConfig() (*Config, error)

func NewConfigUsing

func NewConfigUsing(configFile string) (*Config, error)

func NewDevelopmentConfig

func NewDevelopmentConfig() (*Config, error)

func (*Config) LogSummary

func (c *Config) LogSummary()

func (*Config) ReadProperty

func (c *Config) ReadProperty(queryPath string) string

ReadProperty lets properties be read from the config using a query path (e.g. "metrics.0.name"). If any errors occur, we return an empty string.

type ConfigMetric

type ConfigMetric struct {
	Enabled       bool              `json:"enabled"`
	Type          string            `json:"type"` // e.g. "build-number", "http"
	Name          string            `json:"name"`
	Method        string            `json:"method"`
	URL           string            `json:"url"`
	Data          map[string]string `json:"data"`
	Headers       map[string]string `json:"headers"`
	Periodicity   Duration          `json:"periodicity"` // Need to use our Duration so we can unmarshal
	Timeout       Duration          `json:"timeout"`
	StringToCheck string            `json:"stringToCheck"`
}

type ConfigMetricsRouter

type ConfigMetricsRouter struct {
	Enabled    bool   `json:"enabled"`
	Verbose    bool   `json:"verbose"`
	CarbonHost string `json:"carbonHost"`
	CarbonPort int    `json:"carbonPort"`
}

type Duration

type Duration struct {
	time.Duration
}

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

type Version

type Version struct {
	BuildNumber int    `json:"buildNumber"`
	Hash        string `json:"hash"`
	ShortHash   string `json:"shortHash"`
}

func NewVersion

func NewVersion() (*Version, error)

func (*Version) BuildHash

func (v *Version) BuildHash() string

Jump to

Keyboard shortcuts

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