config

package
v0.0.0-...-748f5db Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2017 License: MIT Imports: 5 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizationGoogleConfigProvider

type AuthorizationGoogleConfigProvider interface {
	GetClientID() string
	GetClientSecret() string
	GetCallbackURI() string
	GetAuthURL() string
	GetTokenURL() string
}

AuthorizationGoogleConfigProvider provides Google authorization access configuration.

type CacheConfigProvider

type CacheConfigProvider interface {
	GetPassword() string
	GetHost() string
	GetPort() string
	GetExpirationTime() time.Duration
}

CacheConfigProvider provides general Cache access configuration.

type Configuration

type Configuration struct {
	Token               TokenConfigProvider
	Password            PasswordConfigProvider
	Postgres            PostgresConfigProvider
	Redis               RedisConfigProvider
	Elasticsearch       ElasticsearchConfigProvider
	AuthorizationGoogle AuthorizationGoogleConfigProvider
}

Configuration keeps all config providers

func New

func New() *Configuration

New reads and creates configuration from path provided in env `$CHIRP_CONFIG_PATH` or from default path `$GOPATH/src/github.com/VirrageS/chirp/backend`.

By setting `$CHIRP_CONFIG_NAME` variable you can specify the name of config file. Default name is `config`.

By setting `$CHIRP_CONFIG_TYPE` variable you can specify which config type will be chosen: `development`, `production` or `test`. Default is `development`.

type DatabaseConfigProvider

type DatabaseConfigProvider interface {
	GetUsername() string
	GetPassword() string
	GetHost() string
	GetPort() string
}

DatabaseConfigProvider provides general Database access configuration.

type ElasticsearchConfigProvider

type ElasticsearchConfigProvider interface {
	GetUsername() string
	GetPassword() string
	GetHost() string
	GetPort() string
}

ElasticsearchConfigProvider provides Elasticsearch access configuration.

type PasswordConfigProvider

type PasswordConfigProvider interface {
	GetRandomPasswordLength() int
}

PasswordConfigProvider provides Password access configuration.

type PostgresConfigProvider

type PostgresConfigProvider interface {
	DatabaseConfigProvider
}

PostgresConfigProvider provides Postgres access configuration.

type RedisConfigProvider

type RedisConfigProvider interface {
	CacheConfigProvider
	GetDB() int
}

RedisConfigProvider provides Redis access configuration.

type TokenConfigProvider

type TokenConfigProvider interface {
	GetSecretKey() []byte
	GetAuthTokenValidityPeriod() time.Duration
	GetRefreshTokenValidityPeriod() time.Duration
}

TokenConfigProvider provides Token access configuration.

Jump to

Keyboard shortcuts

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