config

package
v0.0.0-...-43548f9 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config provides the configuration for Janus. All configurations should be set in environment variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppdashTracing

type AppdashTracing struct {
	DSN string `envconfig:"TRACING_APPDASH_DSN"`
	URL string `envconfig:"TRACING_APPDASH_URL"`
}

AppdashTracing holds the Appdash tracing configuration

type Basic

type Basic struct {
	Users map[string]string `envconfig:"BASIC_USERS"`
}

Basic holds the basic users configurations

type Credentials

type Credentials struct {
	// Algorithm defines admin JWT signing algorithm.
	// Currently the following algorithms are supported: HS256, HS384, HS512.
	Algorithm string `envconfig:"ALGORITHM"`
	Secret    string `envconfig:"SECRET"`
	Github    Github
	Basic     Basic
}

Credentials represents the credentials that are going to be used by admin JWT configuration

type Database

type Database struct {
	DSN string `envconfig:"DATABASE_DSN"`
}

Database holds the configuration for a database

type Github

type Github struct {
	Organizations []string          `envconfig:"GITHUB_ORGANIZATIONS"`
	Teams         map[string]string `envconfig:"GITHUB_TEAMS"`
}

Github holds the github configurations

func (*Github) IsConfigured

func (auth *Github) IsConfigured() bool

IsConfigured checks if github is enabled

type GoogleCloudTracing

type GoogleCloudTracing struct {
	ProjectID    string `envconfig:"TRACING_GC_PROJECT_ID"`
	Email        string `envconfig:"TRACING_GC_EMAIL"`
	PrivateKey   string `envconfig:"TRACING_GC_PRIVATE_KEY"`
	PrivateKeyID string `envconfig:"TRACING_GC_PRIVATE_ID"`
}

GoogleCloudTracing holds the Google Application Default Credentials

type Specification

type Specification struct {
	Port                 int           `envconfig:"PORT"`
	Debug                bool          `envconfig:"DEBUG"`
	GraceTimeOut         int64         `envconfig:"GRACE_TIMEOUT"`
	MaxIdleConnsPerHost  int           `envconfig:"MAX_IDLE_CONNS_PER_HOST"`
	BackendFlushInterval time.Duration `envconfig:"BACKEND_FLUSH_INTERVAL"`
	CloseIdleConnsPeriod time.Duration `envconfig:"CLOSE_IDLE_CONNS_PERIOD"`
	Log                  logging.LogConfig
	Web                  Web
	Database             Database
	Storage              Storage
	Stats                Stats
	Tracing              Tracing
	TLS                  TLS
}

Specification for basic configurations

func Load

func Load(configFile string) (*Specification, error)

Load configuration variables

func LoadEnv

func LoadEnv() (*Specification, error)

LoadEnv loads configuration from environment variables

type Stats

type Stats struct {
	DSN                   string   `envconfig:"STATS_DSN"`
	Prefix                string   `envconfig:"STATS_PREFIX"`
	IDs                   string   `envconfig:"STATS_IDS"`
	AutoDiscoverThreshold uint     `envconfig:"STATS_AUTO_DISCOVER_THRESHOLD"`
	AutoDiscoverWhiteList []string `envconfig:"STATS_AUTO_DISCOVER_WHITE_LIST"`
	ErrorsSection         string   `envconfig:"STATS_ERRORS_SECTION"`
}

Stats holds the configuration for stats

type Storage

type Storage struct {
	DSN string `envconfig:"STORAGE_DSN"`
}

Storage holds the configuration for a storage

type TLS

type TLS struct {
	Port     int    `envconfig:"PORT"`
	CertFile string `envconfig:"CERT_PATH"`
	KeyFile  string `envconfig:"KEY_PATH"`
	Redirect bool   `envconfig:"REDIRECT"`
}

TLS represents the TLS configurations

func (*TLS) IsHTTPS

func (s *TLS) IsHTTPS() bool

IsHTTPS checks if you have https enabled

type Tracing

type Tracing struct {
	GoogleCloudTracing GoogleCloudTracing `mapstructure:"googleCloud"`
	AppdashTracing     AppdashTracing     `mapstructure:"appdash"`
}

Tracing represents the distributed tracing configuration

func (Tracing) IsAppdashEnabled

func (t Tracing) IsAppdashEnabled() bool

IsAppdashEnabled checks if appdash is enabled

func (Tracing) IsGoogleCloudEnabled

func (t Tracing) IsGoogleCloudEnabled() bool

IsGoogleCloudEnabled checks if google cloud is enabled

type Web

type Web struct {
	Port        int  `envconfig:"API_PORT"`
	ReadOnly    bool `envconfig:"API_READONLY"`
	Credentials Credentials
	TLS         TLS
}

Web represents the API configurations

Jump to

Keyboard shortcuts

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