config

package
v0.0.0-...-f984256 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2017 License: MIT Imports: 2 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 Application

type Application struct {
	Name    string `envconfig:"APP_NAME" default:"Janus"`
	Version string `envconfig:"APP_VERSION" default:"1.0"`
}

Application represents a simple application definition

type Credentials

type Credentials struct {
	Secret   string `envconfig:"SECRET" required:"true"`
	Username string `envconfig:"ADMIN_USERNAME" default:"admin"`
	Password string `envconfig:"ADMIN_PASSWORD" default:"admin"`
}

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

type Database

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

Database holds the configuration for a database

type Specification

type Specification struct {
	Port                int    `envconfig:"PORT"`
	Debug               bool   `envconfig:"DEBUG"`
	LogLevel            string `envconfig:"LOG_LEVEL" default:"info"`
	GraceTimeOut        int64  `envconfig:"GRACE_TIMEOUT"`
	MaxIdleConnsPerHost int    `envconfig:"MAX_IDLE_CONNS_PER_HOST"`
	InsecureSkipVerify  bool   `envconfig:"INSECURE_SKIP_VERIFY"`
	StorageDSN          string `envconfig:"REDIS_DSN"`

	// Path of certificate when using TLS
	CertPathTLS string `envconfig:"CERT_PATH"`
	// Path of key when using TLS
	KeyPathTLS string `envconfig:"KEY_PATH"`

	// Flush interval for upgraded Proxy connections
	BackendFlushInterval time.Duration `envconfig:"BACKEND_FLUSH_INTERVAL" default:"20ms"`

	// Defines the time period of how often the idle connections maintained
	// by the proxy are closed.
	CloseIdleConnsPeriod time.Duration `envconfig:"CLOSE_IDLE_CONNS_PERIOD"`

	Database    Database
	Statsd      Statsd
	Credentials Credentials
	Application Application
}

Specification for basic configurations

func LoadEnv

func LoadEnv() (*Specification, error)

LoadEnv loads environment variables

func (*Specification) IsHTTPS

func (s *Specification) IsHTTPS() bool

type Statsd

type Statsd struct {
	DSN    string `envconfig:"STATSD_DSN"`
	Prefix string `envconfig:"STATSD_PREFIX"`
}

Statsd holds the configuration for statsd

Jump to

Keyboard shortcuts

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