config

package
v0.0.0-...-b40c5a5 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2018 License: MIT Imports: 6 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 Basic

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

Basic holds the basic users configurations

type Cluster

type Cluster struct {
	UpdateFrequency time.Duration `envconfig:"BACKEND_UPDATE_FREQUENCY"`
}

Cluster represents the cluster configuration

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"`
	JanusAdminTeam string `envconfig:"JANUS_ADMIN_TEAM"`
	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 JaegerTracing

type JaegerTracing struct {
	SamplingServerURL   string        `envconfig:"TRACING_JAEGER_SAMPLING_SERVER_URL"`
	SamplingParam       float64       `envconfig:"TRACING_JAEGER_SAMPLING_PARAM"`
	SamplingType        string        `envconfig:"TRACING_JAEGER_SAMPLING_TYPE"`
	BufferFlushInterval time.Duration `envconfig:"TRACING_JAEGER_BUFFER_FLUSH_INTERVAL"`
	LogSpans            bool          `envconfig:"TRACING_JAEGER_LOG_SPANS"`
	QueueSize           int           `envconfig:"TRACING_JAEGER_QUEUE_SIZE"`
}

JaegerTracing holds the Jaeger tracing configuration

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"`
	RequestID            bool          `envconfig:"REQUEST_ID_ENABLED"`
	Log                  logging.LogConfig
	Web                  Web
	Database             Database
	Stats                Stats
	Tracing              Tracing
	TLS                  TLS
	Cluster              Cluster
}

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"`
	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 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 {
	Provider           string             `envconfig:"TRACING_PROVIDER"`
	ServiceName        string             `envconfig:"TRACING_SERVICE_NAME"`
	GoogleCloudTracing GoogleCloudTracing `mapstructure:"googleCloud"`
	JaegerTracing      JaegerTracing      `mapstructure:"jaeger"`
}

Tracing represents the distributed tracing configuration

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