config

package
v0.0.0-...-8d1786a Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: Apache-2.0 Imports: 7 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// PersisterNameToType maps valid persister names to the types above
	PersisterNameToType = map[string]PersisterType{
		"none":       PersisterTypeNone,
		"postgresql": PersisterTypePostgresql,
	}
)

Functions

func OutputUsage

func OutputUsage(configStruct interface{}, appName string, envarPrefix string)

OutputUsage is a generic function to output a list of available environment vars based on the given config struct.

func PopulateFromDotEnv

func PopulateFromDotEnv(envEnvVar string) error

PopulateFromDotEnv attempts to retrieve env vars from .env files to populate into the environment. envEnvVar passed in indicates the env var that specifies the environment to use "test", "development", "production" for the .env file

Types

type PersisterConfig

type PersisterConfig interface {
	PersistType() PersisterType
	Address() string
	Port() int
	Dbname() string
	User() string
	Password() string
	PoolMaxConns() *int
	PoolMaxIdleConns() *int
	PoolConnLifetimeSecs() *int
	DataVersion() string
}

PersisterConfig defines the interfaces for persister-related configuration

type PersisterType

type PersisterType int

PersisterType is the type of persister to use.

const (
	// PersisterTypeInvalid is an invalid persister value
	PersisterTypeInvalid PersisterType = iota

	// PersisterTypeNone is a persister that does nothing but return default values
	PersisterTypeNone

	// PersisterTypePostgresql is a persister that uses PostgreSQL as the backend
	PersisterTypePostgresql
)

func PersisterTypeFromName

func PersisterTypeFromName(typeStr string) (PersisterType, error)

PersisterTypeFromName returns the correct persisterType from the string name

Jump to

Keyboard shortcuts

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