common

package
v0.0.0-...-dfdf43d Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration interface {
	// GetLifeCycle retrieves the configured life cycle.
	GetLifeCycle() LifeCycle
	// GetRepoType retrieves the configured repo type.
	GetRepoType() UserRepositoryType
	// GetTimeout retrieves the configured request timeout.
	GetTimeout() time.Duration
	// GetPort retrieves the configured port.
	GetPort() int

	// GetInitDataSet retrieves the path to an initial dataset to load on app launch, mostly for testing and dev use.
	GetInitDataSet() string

	// GetPgUrl retrieves the configured url string for connecting to PostgreSQL.
	GetPgUrl() string

	// GetTokenSecretKey a shared secret key for signing tokens
	GetTokenSecretKey() string

	// GetTokenPrivateKey retrieves the the private key used to sign tokens.
	GetTokenPrivateKey() *rsa.PrivateKey

	// GetTokenPublicKey retrieves public key used to validate JWT tokens.
	GetTokenPublicKey() *rsa.PublicKey
}

Configuration provides methods for retrieving aspects of the applications configuration.

func GetConfiguration

func GetConfiguration() (Configuration, error)

GetConfiguration constructs a Configuration based on environment variables.

type LifeCycle

type LifeCycle int

LifeCycle represents a particular application life cycle.

const (
	// DevLifeCycle represents the development environment.
	DevLifeCycle LifeCycle = 0
	// PreProdLifeCycle represents the pre production environment.
	PreProdLifeCycle LifeCycle = iota
	// ProdLifeCycle represents the production environment.
	ProdLifeCycle LifeCycle = iota
)

func (LifeCycle) String

func (lc LifeCycle) String() string

type User

type User struct {
	Email string `json:"email"`
}

User holds information on a user.

type UserRepositoryType

type UserRepositoryType int

UserRepositoryType represents a type of UserRepository

const (
	// InMemoryRepo represents a UserRepository that is stored entirely in memory.
	InMemoryRepo UserRepositoryType = 0
	// PostgreSqlRepo represents a UserRepository that utilizes a PostgreSQL database.
	PostgreSqlRepo UserRepositoryType = iota
)

func (UserRepositoryType) String

func (prt UserRepositoryType) String() string

Jump to

Keyboard shortcuts

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