config

package
v0.0.0-...-ce8de81 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 6 Imported by: 53

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"`
	Timeout        time.Duration `envconfig:"TOKEN_TIMEOUT"`
	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 JaegerTracing

type JaegerTracing struct {
	SamplingServerURL  string `envconfig:"TRACING_JAEGER_SAMPLING_SERVER_URL"`
	SamplingServerHost string `envconfig:"JAEGER_AGENT_HOST"`
	SamplingServerPort string `envconfig:"JAEGER_AGENT_PORT"`
}

JaegerTracing holds the Jaeger tracing configuration

type RespondingTimeouts

type RespondingTimeouts struct {
	ReadTimeout  time.Duration `envconfig:"RESPONDING_TIMEOUTS_READ_TIMEOUT"`
	WriteTimeout time.Duration `envconfig:"RESPONDING_TIMEOUTS_WRITE_TIMEOUT"`
	IdleTimeout  time.Duration `envconfig:"RESPONDING_TIMEOUTS_IDLE_TIMEOUT"`
}

RespondingTimeouts contains timeout configurations for incoming requests to the Janus instance.

type Specification

type Specification struct {
	Port                 int           `envconfig:"PORT"`
	GraceTimeOut         int64         `envconfig:"GRACE_TIMEOUT"`
	MaxIdleConnsPerHost  int           `envconfig:"MAX_IDLE_CONNS_PER_HOST"`
	BackendFlushInterval time.Duration `envconfig:"BACKEND_FLUSH_INTERVAL"`
	IdleConnTimeout      time.Duration `envconfig:"IDLE_CONN_TIMEOUT"`
	ConnPurgeInterval    time.Duration `envconfig:"CONN_PURGE_INTERVAL"`
	RequestID            bool          `envconfig:"REQUEST_ID_ENABLED"`
	Log                  logging.LogConfig
	Web                  Web
	Database             Database
	Stats                Stats
	Tracing              Tracing
	TLS                  TLS
	Cluster              Cluster
	RespondingTimeouts   RespondingTimeouts
}

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"`
	Exporter              string   `envconfig:"STATS_EXPORTER"`
}

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 {
	Exporter         string        `envconfig:"TRACING_EXPORTER"`
	ServiceName      string        `envconfig:"TRACING_SERVICE_NAME"`
	SamplingStrategy string        `envconfig:"TRACING_SAMPLING_STRATEGY"`
	SamplingParam    float64       `envconfig:"TRACING_SAMPLING_PARAM"`
	DebugTraceKey    string        `envconfig:"TRACING_DEBUG_TRACE_KEY"`
	IsPublicEndpoint bool          `envconfig:"TRACING_IS_PUBLIC_ENDPOINT"`
	JaegerTracing    JaegerTracing `mapstructure:"jaeger"`
}

Tracing represents the distributed tracing configuration

type Web

type Web struct {
	Port        int `envconfig:"API_PORT"`
	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